1

当用户将设备横向的方向更改为纵向模式时,我的应用程序完整方向应该更改我如何更改完整的应用程序方向而不是特定视图我需要更改整个应用程序

4

2 回答 2

0

转到目标 --> 支持的设备方向 --> 选择所需的方向

编辑

尝试这个

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    // return YES;
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
于 2012-10-17T10:21:48.977 回答
0

来自 Apple.developer:基于 iOS 的设备中的加速度计可以确定设备的当前方向。默认情况下,应用同时支持纵向和横向。当基于 iOS 的设备的方向发生变化时,系统会发出UIDeviceOrientationDidChangeNotification通知,让任何相关方知道发生了变化。默认情况下,UIKit 框架会监听这个通知并使用它来自动更新你的界面方向。这意味着,除了少数例外,您根本不需要处理此通知。

实现supportedInterfaceOrientations 方法

 - (NSUInteger)supportedInterfaceOrientations

    {    
        return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;    
    } 

在此处查看更多详细信息

于 2012-10-17T10:32:08.400 回答