2011-12-14 30 views
0

我确实有五个视图控制器,我从第一视图导航控制器到结束视图控制器(第五视图控制器)如何限制更改为风景Iphone?

在中间我做第三个视图我需要做方向。景观和potrait模式。

从那里它只需要potrait模式。

我在fouth viewController中添加了这个委托方法。但它不影响

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Overriden to allow any orientation. 
    //Support orientation for Portrait 
     return (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation==UIInterfaceOrientationPortrait); 
} 

回答

0

只是做。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    if (interfaceOrientation == UIInterfaceOrientationLandscape) 
    return NO; 
else 
    return YES; 
} 
+0

它不工作,先生? – user905582 2011-12-14 07:15:05

+0

我已更新我的回答 – 2011-12-14 07:41:24

0

我觉得你改变方向在第一view.Open你的第三个观点,写这个方法然后改变任何你想要的......我想你应该在所有的观点写这篇期待第三种观点...

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

现在在你的第三个视图编写代码....

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
// Overriden to allow any orientation. 
//Support orientation for Portrait 
    return NO; 
}