shouldAutorotateToInterfaceOrientation与iPad和iPhone的区别
我有一个iPhone应用程序,我已创建为通用iPad/iPhone应用程序。我已经为iPad版本实现了一个splitviewcontroller ......都很好。shouldAutorotateToInterfaceOrientation与iPad和iPhone的区别
在我的iPhone应用程序中,除了第二级视图控制器(网络视图)之外,所有内容均以纵向显示,其中我重写了shouldAutorotateToInterfaceOrientation以允许横向显示。在返回视图链上我回到肖像..非常好!
但是,现在我的iPad拆分视图应用程序被迫留在肖像。如果我重写shouldAutorotateToInterfaceOrientation在我的任何视图像rootviewcontroller或其他人,它有效地允许横向模式在我的iPhone应用程序,我不能做。但它确实解决了我在iPad中的景观问题。
有没有办法解决这个问题?我实际上想要对iPad的shouldAutorotateToInterfaceOrientation表示YES,但对iPhone不表示。我试过,但它不起作用,它允许在两个设备上的景观:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
BOOL rotate = NO;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
rotate = YES;
}
return rotate;
}
有什么建议吗?
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return YES;
} else {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
谢谢你奥莱 - 那正是它:) – mootymoots 2010-11-19 14:01:45
您是否知道上述修复方法是否适用于在启动本机视频播放器时旋转我的应用程序? – nate8684 2012-06-26 17:56:37