2011-09-22 52 views
0

嗨我有一个iPhone应用程序,其中有2个按钮,当我点击其中一个按钮时,UITabViewController有4个选项卡以模态方式打开。我需要在这个UITabViewController中旋转Portrait和lanscape viewcontroller。我不需要旋转Tabviewcontroller中的所有视图控制器,只需要一个viewController。请帮帮我 。UIviewcontroller AutorotateToInterfaceOrientation在UITabViewController里面

在此先感谢。

回答

0

你不想旋转需要的任何视图控制器定义它自己版本的shouldAutorotateToInterfaceOrientation方法的这样

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

要做到这一点,你可能要继承特定视图控制器,只是将这一一种习惯方法

更新: 这听起来像你有多个视图控制器同时激活。

如果您在所有基于viewcontroller的对象的所有shouldAutorotateToInterfaceOrientation方法中放置了一些调试代码,我的猜测是只有一个接收到旋转事件的通知。

在这种情况下,由于很难知道哪个人会收到轮换事件通知,因此您必须对其进行修改,以便以某种方式将通知分发给对方。

+0

它不适用于UITabViewController。 –

+0

用更长的评论编辑我的答案... –

相关问题