UITableViewStyleGrouped和plain的两种格式的区别
来源:互联网 发布:淘宝客服对话技巧 编辑:程序博客网 时间:2024/04/29 13:25
一、UITableViewStylePlain
1.有多段时 段头停留(自带效果)
2.没有中间的间距和头部间距(要想有的重写UITableViewCell \UITableViewHeaderFooterView里面的setFrame方法)
扩展:让段头不停留(取消粘性效果)
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat sectionHeaderHeight = 30;
if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) {
scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
} else if (scrollView.contentOffset.y>=sectionHeaderHeight) {
scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
}
}
二、UITableViewStyleGroup
注意:去掉头部和中间间隔
正确的理解方法
1.设置标头的高度为特小值 (不能为零 为零的话苹果会取默认值就无法消除头部间距了)
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0.001)];
view.backgroundColor = [UIColor redColor];
self.tableView.tableHeaderView = view;
2.写代理方法(中间的留白其实是段尾的高度 代理的作用设置段尾的高度 返回值也不能为0)
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.01f;
}
特殊的处理方法也能实现该效果
1. self.tableView.contentInset = UIEdgeInsetsMake(-44, 0, 0, 0);
2.重写UITableViewHeaderFooterView的
-(void)setFrame:(CGRect)frame{
frame.size.height+=10;
[super setFrame:frame];
}
- UITableViewStyleGrouped和plain的两种格式的区别
- UITableViewStyleGrouped和plain的两种格式的区别
- iOS UITableViewStylePlain 和 UITableViewStyleGrouped的区别
- UITableView UITableViewStylePlain 和 UITableViewStyleGrouped的区别
- text/html和text/plain的区别
- text/html和text/plain的区别
- tableView的 Plain 和 Grouped 区别
- jsp两种注释格式的区别
- UITableViewStyleGrouped的间距问题
- text/html & text/plain的区别
- text/html & text/plain的区别
- text/html & text/plain的区别
- text/html & text/plain的区别
- text/html & text/plain的区别
- tableview的plain与group区别
- text/html & text/plain的区别
- iOS开发之UITableView的两种类型(plain和group)
- UITableViewStyleGrouped背景颜色的处理
- 获取目录下所有子文件及子文件夹
- 通过java.net.URLConnection发送HTTP请求的方法
- logback和slf4j的使用之encoder和Layout
- Matlab画图技巧之保存超大体积图
- R语言处理缺失值的高级方法 ---后面有一些python画图的语句
- UITableViewStyleGrouped和plain的两种格式的区别
- 华为机试-C++--DNA序列
- Android项目开发错误锦集-DuplicateFileException
- DNS 工作原理
- 腾讯 美团 百度 网易游戏 2015校园招聘南京笔试面试之总结分析
- 机器学习中的范数规则化之(二)核范数与规则项参数选择
- Android网络资料
- selenium+eclipse搭建及编写第一个test代码2(WebDriver)
- tjut 5387