UITableView UITableViewStylePlain UITableViewStyleGrouped
2016-07-20 16:20
417 查看
一。如何选择grouped Or Plain
1.grouped的sectionHeader,sectionFooter的背景色默认跟tableview的背景色一样。plain反之
2.grouped的sectionHeader不会悬浮。plain反之。
3.plain会出现多余的分割线,grouped不会。
4.grouped某一行的上线边缘默认会有分割线。
5.优先使用grouped。
6.不管使用那种类型,不建议使用_tableView.sectionHeaderHeight =1; _tableView.sectionFooterHeight =50这种来定义sectionView高度,建议实现代理方法。因为有的时候grouped好像不起效果。
UITableViewStylePlain 类型时,
解决多余分割线问题,
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0,0,CGRectGetWidth(self.view.bounds),0)];
_tableView.tableFooterView = v;
解决默认sectionHeader sectionFooter颜色问题
- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view
forSection:(NSInteger)section {
view.tintColor = [NWUtility colorWithHex:0xF0F0F0];
}
UITableViewStyleGrouped类型时:不会出现多余分割线问题,所以不用设置tableFootView.
UITableViewStylePlain滑动时才会有section停留效果,UITableViewStyleGrouped没有。
1.grouped的sectionHeader,sectionFooter的背景色默认跟tableview的背景色一样。plain反之
2.grouped的sectionHeader不会悬浮。plain反之。
3.plain会出现多余的分割线,grouped不会。
4.grouped某一行的上线边缘默认会有分割线。
5.优先使用grouped。
6.不管使用那种类型,不建议使用_tableView.sectionHeaderHeight =1; _tableView.sectionFooterHeight =50这种来定义sectionView高度,建议实现代理方法。因为有的时候grouped好像不起效果。
UITableViewStylePlain 类型时,
解决多余分割线问题,
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0,0,CGRectGetWidth(self.view.bounds),0)];
_tableView.tableFooterView = v;
解决默认sectionHeader sectionFooter颜色问题
- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view
forSection:(NSInteger)section {
view.tintColor = [NWUtility colorWithHex:0xF0F0F0];
}
UITableViewStyleGrouped类型时:不会出现多余分割线问题,所以不用设置tableFootView.
UITableViewStylePlain滑动时才会有section停留效果,UITableViewStyleGrouped没有。
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- 样式表CSS布局经验
- 大家看了就明白了css样式中类class与标识id选择符的区别小结
- 重置默认样式 css reset第1/2页
- jQuery操作属性和样式详解
- jQuery根据用户电脑是mac还是pc加载对应样式的方法
- 判断li是否有样式的js代码
- 鼠标移入移出改变CSS样式的小例子
- Bootstrap学习笔记之css样式设计(2)
- JavaScript 动态加载脚本和样式的方法
- 获取内联和链接中的样式(js代码)
- document.write()及其输出内容的样式、位置控制
- 利用JavaScript更改input中radio和checkbox样式
- Bootstrap学习笔记之css样式设计(1)