Jor*_*n H 2 boolean objective-c backwards-compatibility ios
我试图找出如何检测外部BOOL是否可用以便我可以支持iOS 7和8. iOS 8中的新功能是一个BOOL,您可以使用它来查明是否启用了Reduce Transparency,并且我想实现检查if语句,但这将在iOS 7上崩溃而不首先检查外部BOOL是否可用.我很惊讶我无法从网络搜索中找到答案.
这是BOOl的定义:
UIKIT_EXTERN BOOL UIAccessibilityIsReduceTransparencyEnabled() NS_AVAILABLE_IOS(8_0);
Run Code Online (Sandbox Code Playgroud)
我正在使用它的位置:
if (UIAccessibilityIsReduceTransparencyEnabled()) {
NSLog(@"transparency is disabled");
}
Run Code Online (Sandbox Code Playgroud)
请阅读SDK兼容性指南.
您需要做的是检查函数是否UIAccessibilityIsReduceTransparencyEnabled存在:
if (UIAccessibilityIsReduceTransparencyEnabled != NULL) {
// function exists, use it
if (UIAccessibilityIsReduceTransparencyEnabled()) {
NSLog(@"transparency is disabled");
}
} else {
// function doesn't exist, do something else
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
875 次 |
| 最近记录: |