gpt4 book ai didi

xcode - 删除 heightForRowAtIndexPath : compatibility with iOs7

转载 作者:行者123 更新时间:2023-12-04 21:29:53 25 4
gpt4 key购买 nike

在新的iOs8中,如果我不实现heightForRowAtIndexPath方法,多行的一行会以正确的高度显示。
但是,如果我想保持对 iOs7 的向后兼容性,我需要实现 heightForRowAtIndexPath 方法...
我如何才能仅在 iOs8 中实现它?

最佳答案

你应该使用定义规则:

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

这里你应该如何使用它:

- (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;
}

关于xcode - 删除 heightForRowAtIndexPath : compatibility with iOs7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26384823/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com