我正在为iPhone开发一个仅限横向的应用程序。
我在Xcode项目设置中选择了所有4个方向,并使用以下委托方法缩小了主视图控制器中应用程序的方向:
- (NSUInteger) supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
除了主要的iOS行为外,一切都按预期工作:我希望iOS能够在尊重设备方向的同时显示通知中心,每个警报和控制中心(在iOS 7设备上),没有< / em>每次都旋转我的应用程序界面。
例如:当我将手机设置为纵向模式时,我希望iOS(通知中心,警报等)上的所有内容都以纵向模式呈现,我的应用程序保持在横向右侧模式下。
这可行吗?
据我所知,Apple在其应用程序中执行此操作,例如默认的Camera应用程序。
是否有可用于实现该方法的公共方法,还是私有API的一部分?