首页 > 移动平台 > 详细

iOS开发基础-UITableView基本属性

时间:2016-02-26 18:39:24      阅读:122      评论:0      收藏:0      [点我收藏+]

  设置 UITableView 中 cell 的背景颜色。

示例1:通过 backgroundView 设置。

1 UIView *view1 = [[UIView alloc] init];
2 view1.backgroundColor = [UIColor blueColor];
3 cell.backgroundView = view1;

示例2:通过 backgroundColor 设置。

1 cell.backgroundColor = [UIColor blueColor];

   backgroundView 的优先级比 backgroundColor 高,如果同时设置了, backgroundView 会覆盖 backgroundColor 。


 

  设置 cell 选中状态的背景。

1 UIView *view2 = [[UIView alloc] init];
2 view2.backgroundColor = [UIColor redColor];
3 cell.selectedBackgroundView = view2;

  设置 UITableView 的其他属性。

1 self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;  //设置分割线样式
2 self.tableView.separatorColor = [UIColor redColor]; //设置分割线颜色
3 self.tableView.tableHeaderView = [UIButton buttonWithType:UIButtonTypeContactAdd];  //设置顶部视图
4 self.tableView.tableFooterView = [[UISwitch alloc] init];   //设置底部视图

 

iOS开发基础-UITableView基本属性

原文:http://www.cnblogs.com/wjq-Law/p/5221020.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!