UITableView 二讲
来源:互联网 发布:pump it up 2012 编辑:程序博客网 时间:2024/04/30 00:41
表格的其它的一些属性,全是代理方法,使用之前可别忘了挂代理。
表头和表尾// 返回表的行数- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ NSArray *citys = list[section][@"Cities"]; return citys.count;}//tableViewCell默认的行高是44- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 44;}//设置表头的高度- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 100;}// 设置表头的视图 有多少表头 就会执行多少次- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *bgview = [[UIView alloc]init]; bgview.backgroundColor = [UIColor lightGrayColor]; UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(10, 40, 180, 30)]; title.font = [UIFont systemFontOfSize:20]; title.text = list[section][@"State"]; [bgview addSubview:title]; return bgview;}// 设置表尾的高度- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 20;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *IDID = @"kkk"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:IDID]; if (cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:IDID]; cell.backgroundColor = [UIColor clearColor]; } cell.textLabel.text = list[indexPath.section][@"Cities"][indexPath.row][@"city"]; return cell;}// 表视图 有多少分组- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return list.count;}
0 0
- UITableView 二讲
- 第十讲:UITableView 编辑
- UITableView<二>
- 第九讲:UITableView表视图
- UITableView详解(二)
- UITableView(二编辑删除)
- UITableView(二编辑插入)
- UITableView(二编辑移动)
- UITableView小知识点(二)
- swift UITableView(二)
- IOS UITableView (二)
- UITableView基本使用(二)
- UITableView(二)----显示数据
- 第⼗一讲:UITableView ⾼级
- UITableView 横向滚动(二)
- UITableView常见问题总结(二)
- iOS UITableView(二)-自定义Cell
- bind9配置精讲(二)
- apk加密流程
- result_cache_max_size设置不了的缘由
- 360APK包与类更改分析
- srm 548
- Android.os.Build
- UITableView 二讲
- iPhone 6s极致体验:3D-Touch+iOS 9系统
- DoTween 七:< 常用方法 —— 渐变旋转>
- 个性化推荐算法python实现
- svn co
- BZOJ2190: [SDOI2008]仪仗队
- js对日期进行升序排序
- 闭门造车
- jquey实现的动态表格的新增及删除行