2013-02-28 46 views
-1
-(NSUInteger)supportedInterfaceOrientations 
    {   
    return UIInterfaceOrientationMaskPortrait; 
    } 

-(BOOL)shouldAutorotate 
    { 
     return NO; 
    } 

我只想在我的应用程序的一个视图中启用landascape方向。其他视图只能支持肖像模式。但是对于iOS 6,即使我使用iOS 6的最新方法,它也会自动旋转。期待正确的建议。ios 6 orientation

+0

检查此链接http://stackoverflow.com/questions/12565188/ios-6-landscape-and-portrait-orientation/14704401#14704401 – Rushabh 2013-02-28 07:34:54

+0

谢谢..但在链接中使用的方法仍然是支持方向。除了支持两个横向和纵向的视图之外,我想要纵向定位。 – Rahul 2013-02-28 09:05:14

+0

看到我的答案.. – 2013-02-28 09:22:50

回答

0

对于肖像仅方向,请尝试以下方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskPortrait; 
} 

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 
    return UIInterfaceOrientationPortrait; 
} 

- (BOOL)shouldAutorotate { 
    return FALSE; 
}