2010-08-18 57 views
0

在我的应用程序中,我在UINavigationController中使用了UITabbarController,当您单击主窗口时,它将着陆到具有景观的细节,而不是那个,我需要更改我的应用程序的方向。我该如何得到它?肖像到风景UITabbar的方向变化?

斯里兰卡

回答

0

你不能强制一个方向,这需要使用私人API。你需要做的是在你的视图控制器上实现下面的方法,并且只为支持的方向返回yes。例如,如果你只支持纵向补充一点:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { 
    return ((orientation==UIInterfaceOrientationPortrait) || (orientation==UIInterfaceOrientationPortraitUpsideDown)) 
} 

另外请注意,您必须重写该方法在每个视图控制器类的,因为this层次结构(复制粘贴&)。

希望它有帮助,我不确定这是否是你要求的。