静态动态cell混合使用
2016-04-07 14:01
381 查看
需要重写的方法
#pragma mark - Table view data source- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return [super tableView:tableView titleForHeaderInSection:section];}
- (NSString*)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{ return [super tableView:tableView titleForFooterInSection:section];}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ return NO;}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{ return NO;}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return [super tableView:tableView heightForFooterInSection:section];}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 2) return 88; return [super tableView:tableView heightForRowAtIndexPath:indexPath];}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return nil;}- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [super numberOfSectionsInTableView:tableView];}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (section == 2) { return self.data.count; } return [super tableView:tableView numberOfRowsInSection:section]; }- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 0) { return 20; } return 30;}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ return [[UIView alloc] init];}
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 2) { return self.data.count; } return indexPath.row;}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 2) { if (self.noticeBtn.selected) { YYOneKindCell *cell = [YYOneKindCell cellWithTableView:tableView]; cell.item = self.data[indexPath.row]; return cell; }else{ YYOtherKindCell *cell = [YYOtherKindCell cellWithTableView:tableView]; cell.item = self.data[indexPath.row]; return cell; } } return [super tableView:tableView cellForRowAtIndexPath:indexPath];}
[/code]
[
调用 didSelectRowAtIndexPath。
http://www.itstrike.cn/question/cba84b8a-150b-47f3-833b-bb683617c02c.html
#pragma mark - Table view data source- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return [super tableView:tableView titleForHeaderInSection:section];}
- (NSString*)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{ return [super tableView:tableView titleForFooterInSection:section];}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ return NO;}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{ return NO;}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return [super tableView:tableView heightForFooterInSection:section];}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 2) return 88; return [super tableView:tableView heightForRowAtIndexPath:indexPath];}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return nil;}- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [super numberOfSectionsInTableView:tableView];}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (section == 2) { return self.data.count; } return [super tableView:tableView numberOfRowsInSection:section]; }- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ if (section == 0) { return 20; } return 30;}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ return [[UIView alloc] init];}
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 2) { return self.data.count; } return indexPath.row;}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.section == 2) { if (self.noticeBtn.selected) { YYOneKindCell *cell = [YYOneKindCell cellWithTableView:tableView]; cell.item = self.data[indexPath.row]; return cell; }else{ YYOtherKindCell *cell = [YYOtherKindCell cellWithTableView:tableView]; cell.item = self.data[indexPath.row]; return cell; } } return [super tableView:tableView cellForRowAtIndexPath:indexPath];}
[/code]
[
调用 didSelectRowAtIndexPath。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; }
http://www.itstrike.cn/question/cba84b8a-150b-47f3-833b-bb683617c02c.html
相关文章推荐
- 5.6 smtp_proto函数:解析smtp协议
- 测试
- Android开源控件PhotoView的使用
- python 输出小数控制
- openCV之头文件分析
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables opt
- Spring中的Ioc
- (转载)iOS开发系列--音频播放、录音、视频播放、拍照、视频录制
- linux(centos6.x)下mysql数据库报错表不存在
- ceph存储 Linux文件空洞与稀疏文件
- iOS 打包ipa之Missing iOS Distribution signing identity问题
- 数据库表字段 实体类字段 命名不匹配
- Oracle 数据库查询表空间sql
- 160407
- android优化注意事项(此处只说建议,不进行解释)
- SparkML之DistributedMatrix(一)
- JS 前端构建工具gulpjs的使用介绍及技巧
- springMVC3学习(九)--redirect和forward跳转
- Drupal 8 提供REST服务实例
- 利用Mat数据结构打开摄像头