2013-03-26 112 views
0

在我的項目設置中,我將支持的接口方向作爲兩個橫向。支持的接口方向和shouldAutorotateToInterfaceOrientation

我還應該在每個視圖控制器下面實現嗎?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 
+1

如果你想在iOS 6中支持ios <6 – 2013-03-26 05:14:15

+0

,那麼這些方法不同於其他任何東西 – Kasaname 2013-03-26 05:15:25

+0

@j_mcnally,所以只需在應用程序設置中指定是不夠的 Saran 2013-03-26 05:35:32

回答

3

的iOS < 6.x的這將是更好

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation // Deprecated in iOS 6.x 
{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

iOS> 6.x

- (BOOL) shouldAutorotate 
{ 
    return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskLandscape; 
} 

希望這會有所幫助。

0

雅它能夠更好地實現,如果你的方向中實現它的Info.plist景觀

爲iOS> 6

- (BOOL) shouldAutorotate 
{ 
    return YES; 
} 

-(NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskLandscape; 
}