tableview 新用法

self.table= [[UITableViewalloc]initWithFrame:CGRectMake(0,20,self.view.frame.size.width,self.view.frame.size.height-20)style:UITableViewStyleGrouped];

self.table.dataSource=self;

self.table.delegate=self;

[self.viewaddSubview:self.table];

//注册某个重用标识对应的Cell类型

[self.tableregisterNib:[UINibnibWithNibName:@"view_Cell"bundle:nil]forCellReuseIdentifier:ID];

//设置每一行cell的高度

self.table.rowHeight=60;

//设置每一组头部的高度

self.table.sectionHeaderHeight=0.01;

//设置每一组尾部的高度

self.table.sectionFooterHeight=0.01;

//设置分割线颜色

self.table.separatorColor= [UIColorredColor];

//设置分割线样式

self.table.separatorStyle=UITableViewCellSeparatorStyleNone;

//设置表头控件

self.table.tableHeaderView= [[UISlideralloc]init];

//设置表尾控件

self.table.tableFooterView= [UIButtonbuttonWithType:UIButtonTypeContactAdd];

//设置右边索引文字的颜色

self.table.sectionIndexColor= [UIColorredColor];

//设置右边索引文字的背景色

self.table.sectionIndexBackgroundColor= [UIColorblackColor];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容