我正在开发通用应用程序。现在我想设置这两种方式的方向:当应用程序在 iPhone 上启动时,它会以纵向模式打开;当应用程序在 iPad 上启动时,它会以横向模式打开。
可能吗?
最佳答案
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
return YES;
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
return YES;
}
return NO;
}
关于iPhone/iPad 通用应用方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5094687/