Gho*_*obs 7 objective-c uitableview ios
我目前的行高设置如下:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == self.expandedSection || indexPath.row <= 3) {
return 65;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我基本上只希望前4行在默认情况下可见,除非该部分是扩展形式,在这种情况下所有行都是可见的.我这样做是通过设置前4到65的行高,其余的为0.行和它们各自的图像没有显示,但是cell.textLabel和cell.detailTextLabels是,导致它们看起来像下面的图片.
如何禁用这两个,以便它们不会显示在第4行的任何行?

将此代码添加到您的cellForRowAtIndexPath中
if (indexPath.section == self.expandedSection || indexPath.row <= 3) {
Cell.hidden = NO;
}
else{
Cell.hidden = YES;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2729 次 |
| 最近记录: |