我想为iOS6用户添加一个UIRefreshControl,为iOS5用户添加一个按钮。我只想(显然)将一个包裹交付给应用商店,那么我该怎么做呢?
我能感觉到操作系统版本
float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
if (ver >= 6.0) {
// Programmatically add UIRefreshControl.
}
但是,如果我想支持iOS5,编译器不会让我使用UIRefreshControl吗?
最佳答案
如果编译器不允许您使用它,请让您愚弄他。您还可以(并且应该为)也从操作系统版本检测切换到功能检测。总而言之:
if (NSClassFromString(@"UIRefreshControl") != Nil) {
id control = [[NSClassFromString(@"UIRefreshControl") alloc] init];
}
关于iphone - UIRefreshControl在iOS6中使用,但在iOS5中不使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15042180/