2011-06-10 36 views
0

我有一個UIViewController其中包含一個新的UIViewController像下面,控制的UIViewController interfaceorientation

@implementation ParentViewController 

- (id)init 
{ 
    // some stuff 
} 

- (BOOL)CreateChildViewController 
{ 
    UIViewController *childVC = [[UIViewController alloc] init]; 
} 

@end 

現在我需要停止childVC的interfaceOrientation。

是否有可能,如果是這樣?

回答

0

嘗試使用:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

任何視圖控制器來確定自動旋轉行爲。

documentation

默認情況下,這種方法只對UIInterfaceOrientationPortrait方向返回YES。如果您的視圖控制器支持其他方向,請覆蓋此方法,併爲其支持的所有方向返回YES。

總之,如果你的子類UIViewController只想支持肖像,你不需要做任何事情。否則,您需要添加此方法並決定是否允許旋轉到另一個方向。

閱讀標題爲「處理視圖旋轉」的部分。

相關問題