您的位置:首页 > 产品设计 > UI/UE

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没有。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS UITableView 样式