2011-06-10 65 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只想支持肖像,你不需要做任何事情。否则,您需要添加此方法并决定是否允许旋转到另一个方向。

阅读标题为“处理视图旋转”的部分。

相关问题