Pro UITableView Chapter 2

往后的文章均以《Pro iOS Table Views》一书为基准,可能对于iOS7有点不适用,具体细节容我稍后再验证。

改变UITableView的背景

设置tableview的背景色为透明色。

[myTableView setBackgroundColor:[UIColor clearColor]];

使用你需要的背景图,新建一个UIImageView。

UIImageView *tableBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage"]];

设置该UIImageView的frame大小。

[tableBackgroundView setFrame: myTableView.frame];

最后将UIImageView替代tableview的背景图。

[myTableView setBackgroundView:tableBackgroundView];

 

posted @ 2014-02-07 15:55  卓毅  阅读(156)  评论(0编辑  收藏  举报