【发布时间】:2015-09-25 13:12:28
【问题描述】:
自更新到 iOS 9.0 以来,我正在尝试清除我的应用程序的所有警告,并且我正在尝试这样做:
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
// less than iOS 9.0
- (NSUInteger)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskPortrait;
} else {
return UIInterfaceOrientationMaskAll;
}
}
#else
// iOS 9.0 or later
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskPortrait;
} else {
return UIInterfaceOrientationMaskAll;
}
}
#endif
但我仍然收到所有警告,我做错了什么?
我发现此指令在 iOS 8.0 和 iOS 7.0 中无法正常工作。
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
【问题讨论】:
标签: ios objective-c ios9 xcode7