UITableviewController的创建以及关于多余分割线问题
2015-08-25 10:29
531 查看
最近用的uitableviewcontroller比较多,因此也遇到了很多的小问题,在此记录一下,省的下次再犯。
1.首先说在创建部分,我们创建一个继承uitableviewcontroller的控制器HSMoreViewController
tableview的样式有两种分别为:UITableViewStylePlain和UITableViewStyleGrouped
首先我们看一下普通样式和分组样式的展示,如图
如果我们需要一个普通样式的,但是又不需要下方多余的分割线怎么办?
如此便可以了,试一下运行效果
2.tableview 分组样式还有一些细节需要我们注意
1.首先说在创建部分,我们创建一个继承uitableviewcontroller的控制器HSMoreViewController
tableview的样式有两种分别为:UITableViewStylePlain和UITableViewStyleGrouped
[code]HSMoreViewController *More=[[HSMoreViewController alloc]initWithStyle:UITableViewStyleGrouped]; //如果我们直接[HSMoreViewController *More=[[HSMoreViewController alloc]init]则创建出来的就是默认样式UITableViewStylePlain,在默认样式下,多余的分割线是不会隐藏的
首先我们看一下普通样式和分组样式的展示,如图
如果我们需要一个普通样式的,但是又不需要下方多余的分割线怎么办?
[code]- (void)viewDidLoad { [super viewDidLoad]; [self.tableView setTableFooterView:[[UIView alloc]initWithFrame:CGRectZero]]; }
如此便可以了,试一下运行效果
2.tableview 分组样式还有一些细节需要我们注意
[code]//返回头部显示的文字 -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if (section==0) { return @"第一组头部"; } return @"第二组头部"; } //返回每一组底部显示的文字 -(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { if (section==0) { return @"第一组底部"; } return @"第二组底部"; } //返回头部的高度 -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 10; } //返回底部的高度 -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { return 0.01f; }
相关文章推荐
- iOS UITextField的全解
- POJ 1503 && HDU 1047 Integer Inquiry(高精度)
- UGUI(九)UI粒子特效
- UGUI(八)UI节点制作
- 【php】include、include_once、require、require_once的区别
- UGUI(七)界面拖动和焦点界面
- QtGui.QComboBox控件常用函数
- Android Studio failed to find build tools revision 19.1.0 问题
- leetcode: (232) Implement Queue using Stacks
- UGUI(六)资源下载之Icon
- UGUI(五)动画系统
- UGUI(四)事件系统的封装
- 解决 ffmpeg yasm not found, use --disable-yasm for a crippled build
- Request(对象)
- UGUI(三)无限循环列表
- The request sent by the client was syntactically incorrect
- UITableViewCell自定义右边的文字以及更改左边图片的大小
- UGUI(二)摄像机渲染纹理
- request
- UGUI(一)List列表的封装