`
xidajiancun
  • 浏览: 454488 次
文章分类
社区版块
存档分类
最新评论

ios开发-设置UITableView/Cell背景设置

 
阅读更多

自带的UITableView默认背景是白色的,在某些应用来说显得过于单调。

但是我们可以自定义背景,使我们的应用多彩一点。

下面介绍两种方法,设置UITableView背景或者Cell背景。


1.TableViewCell背景设置

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

cell.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Default.png"]]; //cell的背景图
cell.textLabel.backgroundColor = [UIColor clearColor];
}


2.TableView背景设置


UIImageView *tableBg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]];
[yourTable setBackgroundView:tableBg];
[tableBg release];

学习的路上,与君共勉。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics