sas*_*ash 8 objective-c uitableview ios
我有一张带静电池的桌子.对于一个单元格,我想根据标签的高度(在单元格内部)更改其高度,同时保持所有其他单元格的高度不变.我怎样才能获得当前细胞的高度?或者也许有更好的方法?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([indexPath section] == 2) {
return self.myLabel.frame.origin.y *2 + self.myLabel.frame.size.height;
} else {
return ...; // what should go here, so the cell doesn't change its height?
}
}
Run Code Online (Sandbox Code Playgroud)
tal*_*las 12
你可以打电话:
[super tableView:tableView heightForRowAtIndexPath:indexPath]
Run Code Online (Sandbox Code Playgroud)
在else块中,如果您更改了默认高度,则无需担心.
| 归档时间: |
|
| 查看次数: |
5874 次 |
| 最近记录: |