-
UITableView的常见设置
- 设置分割线颜色
self.tableView.separatorColor = [UIColor redColor];- 隐藏分割线,在需要自定义分割线时可以先更改该属性,然后再添加想要的分割线样式,用AutoLayout设置在每行的底部即可
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; -
UITableViewCell的常见设置
- 取消选中的样式,在单纯的展示数据时可用
cell.selectionStyle = UITableViewCellSelectionStyleNone;- 设置选中的背景色
UIView *selectedBackgroundView = [[UIView alloc] init]; selectedBackgroundView.backgroundColor = [UIColor redColor]; cell.selectedBackgroundView = selectedBackgroundView;- 设置默认的背景色,两种方法,需要注意的是backgroundView的优先级 大于 backgroundColor
UIView *selectedBackgroundView = [[UIView alloc] init]; selectedBackgroundView.backgroundColor = [UIColor redColor]; cell.selectedBackgroundView = selectedBackgroundView;cell.backgroundColor = [UIColor blueColor];-
设置指示器
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
-
最右侧添加控件
cell.accessoryView = [[UISwitch alloc] init];
UITableView(四)几种常用设置
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 掌握 设置UITableView的dataSource、delegate UITableView多组数据和单组数据...
- 序引 本系列文章将介绍iOS开发中的UITableView控件,将会分成四篇文章完整的讲述UITableView的...