我已经在UIInterfaceOrientationMaskAll
方法中设置了supportedInterfaceOrientations
。
当我显示UIModalViewController
时,无论屏幕旋转如何,我总是获得748 x 1024视图的尺寸。如果旋转屏幕,尺寸将不会更新,并且在纵向和横向模式下均相同:748 x 1024。
这是呈现模态视图的代码:
MyModalViewController *myModal = [[MyModalViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:myModal animated:YES];
MyModalViewController扩展了另一个MyCUSTOMViewController,它是
UIViewController
的子类:@interface MyModalViewController : MyCUSTOMViewController
@interface MyCUSTOMViewController : UIViewController
我究竟做错了什么?
最佳答案
根据我的阅读,有几件事情需要考虑:
-(NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
中覆盖UIApplicationDelegate
,并返回 UIInterfaceOrientationMaskAll
:- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}