设置UITableView section之间的间距
2016-07-09 13:54
405 查看
当UITableView的style为UITableViewStyleGrouped时,section之间默认的距离往往不是我们想要的。那怎么设置呢?我们知道每个section都有自己的header和footer,它们的高度和就是section之间的间距。知道间距的问题所在就好改了。很简单:
_tableView.sectionHeaderHeight
= 10;
_tableView.sectionFooterHeight
= 10;
那section之间的距离就是20(10 +10)了;
如果你发现_tableView的顶部还是有间距,不用担心,那是UITableView的header引起的,这样就好了:
_tableView.tableHeaderView
= [[UIViewalloc]initWithFrame:CGRectMake(0.0f,0.0f,_tableView.bounds.size.width,0.01f)];
_tableView.sectionHeaderHeight
= 10;
_tableView.sectionFooterHeight
= 10;
那section之间的距离就是20(10 +10)了;
如果你发现_tableView的顶部还是有间距,不用担心,那是UITableView的header引起的,这样就好了:
_tableView.tableHeaderView
= [[UIViewalloc]initWithFrame:CGRectMake(0.0f,0.0f,_tableView.bounds.size.width,0.01f)];
相关文章推荐
- [ios]UITabBarItem 更改图像的高度和宽度
- vue入门例子 增删条目
- 【算法技巧】尺取法 POJ 3061 Subsequence
- STL priority_queue 优先级队列
- 300. Longest Increasing Subsequence
- UITableViewCell的backGroundView和selectedBackgroundView在cell中的层次
- UITableViewCell改变选中时背景样式
- iOS UITableView取消SectionView停滞效果
- EasyUI -- Layout(布局)
- 深度解析Java8 – AbstractQueuedSynchronizer的实现分析(下)
- 深度解析Java8 – AbstractQueuedSynchronizer的实现分析(上)
- 303. Range Sum Query - Immutable
- Find Closet Pairs -- To be continue
- hdu 5064 Find Sequence(DP,单调性优化)
- dispatch_set_target_queue 说明
- Qt5 UI信号、槽自动连接的控件重名大坑
- 【bzoj1568】[JSOI2008]Blue Mary开公司 超哥线段树
- SwipeBackActivity滑动时黑底不透明问题
- EasyUI Pagination 分页的两种做法小结
- STL系列之一 deque双向队列