【问题标题】:objective c - change to another navigationcontroller of viewcontroller目标c - 更改为viewcontroller的另一个navigationcontroller
【发布时间】:2014-10-16 15:07:39
【问题描述】:
我有问题:有一个带有视图控制器的可定向(可旋转)导航控制器。我想换一个新的viewcontroller的navigationcontroller,它是不可定位的。
我尝试只用旧的导航控制器更改 Viewcontroller,但在这种情况下,应用程序仍然是可旋转的。
感谢您的帮助,对不起我的英语。
【问题讨论】:
标签:
ios
objective-c
orientation
viewcontroller
navigationcontroller
【解决方案1】:
你必须重新定义另一个 NavigationController 并阻止你想要的旋转。当你想要推送你的视图控制器时,调用另一个导航控制器。
YourCustomNavigationController *kiwappNav = [[YourCustomNavigationController alloc] initWithRootViewController:yourViewController];
[self.navigationController pushViewController:kiwappNav animated:YES];
还有你的自定义 navigationController 例如:
#pragma mark - Orientation
- (BOOL) shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
switch ([Device getDeviceFormat])
{
case DF_IPAD:
return UIInterfaceOrientationMaskAll;
break;
case DF_IPOD:
return UIInterfaceOrientationMaskPortrait;
break;
default:
return UIInterfaceOrientationMaskAll;
break;
}
}
希望对你有所帮助。