mat*_*lel 3 xcode uitableview heightforrowatindexpath ios8
在新的iOs8中,如果我没有实现该heightForRowAtIndexPath方法,将以正确的高度显示具有多行的行.
但是,如果我想保持与iOs7的后向兼容性,我需要实现该heightForRowAtIndexPath方法......
我怎样才能在iOs8中实现它?
您应该使用define rule:
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
Run Code Online (Sandbox Code Playgroud)
在这里你应该如何使用它:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
return 100.0;//your custom height here
else
return UITableViewAutomaticDimension;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1283 次 |
| 最近记录: |