UITableView 凹注意事项

简介: UITableView :一、注意方法实现顺序, table.tableFooterView 或者 table.tableHeaderView 提前2行你将看到感觉不太好的UI。

UITableView :

一、注意方法实现顺序, table.tableFooterView 或者 table.tableHeaderView 提前2行你将看到感觉不太好的UI。

table = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
table.backgroundColor = [UIColor  clearColor];
table.separatorColor = kLineColor;
table.delegate = self;
table.dataSource = self;
table.tableFooterView = [UIView new];

二、style使用 UITableViewStyleGrouped 时

为保证版本上空白间隙体现一致 同时实现以下方法:
tableView.sectionHeaderHeight = 0.00001;
tableView.sectionFooterHeight = 0.00001;
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
     return 0.00001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 12;
}

三、实现去掉UITableViewStyleGrouped类型UITableView头部高度,但是为了调整分区之间的间距还是需要实现heightForFooterInSection方法的。

table.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
目录
相关文章
|
iOS开发
iOS开发之有间距的UITableViewCell
UITableView是最常用的一个iOS控件,现要做一个如下图的UITableView,其中白色部分就是cell,可是默认的UITableView中cell之间是没有间隔的,那么办呢?网上有2种做法,我这里顺带提一下吧 效果图.png 1、方式一 通过设置cell的contentView来间接实现,在cell的contentView的顶部或者底部留下一定的间距,这样就会有cell间就有间距的效果。
1380 0
|
iOS开发
iOS开发 - UITableView的tableHeaderView注意事项(遮挡cell,内容重复等等)
iOS开发 - UITableView的tableHeaderView注意事项(遮挡cell,内容重复等等)
323 0
|
iOS开发
iOS UITableViewCell嵌套CollectionView,tableview和collectionview同时滑动bug修复
iOS UITableViewCell嵌套CollectionView,tableview和collectionview同时滑动bug修复
976 0