我有一段代码只适用于iOS 6或更高版本.
control.tintColor = [UIColor greenColor];
Run Code Online (Sandbox Code Playgroud)
是否有现成的编译器指令#ifdef iOS6_or_greater?
And*_*rew 17
最好是检查功能,而不是iOS版本.
例如,您可以使用respondsToSelector来查看是否支持给定方法.
[someObject respondsToSelector:@selector(someMethod)]
Run Code Online (Sandbox Code Playgroud)
如果做不到这一点,就会有一个预处理器指令
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
- (BOOL)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
#endif
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4038 次 |
| 最近记录: |