我对堆栈溢出和objective编程都很陌生。我已经搜索了下面描述的问题,但我无法找到一个可行的解决方案。
我的应用程序是一个简单的离线浏览应用程序,具有导航结构。在appDelegate中,我以下列方式之一加载RootViewController (UITableViewController):
解A
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
return YES;溶液B
RootViewController* rootviewcontroller = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:rootviewcontroller];rootViewController只是简单地推送一些视图,即
TipAndTrickViewController *mTipAndTrick = [[TipAndTrickViewController alloc]initWithNibName:@"TipAndTrickViewController" bundle:nil];
[self.navigationController pushViewController:mTipAndTrick animated:YES];在更深层次的视图中,我介绍了一个详细的modalView (UIViewController)。我想要的是只在最后一个视图中启用自动访问。对于所有的预言家来说,门户定位是他们想要的。最后一个视图以正确的方式实现:
shouldAutorotateToInterfaceOrientation:interfaceOrientation shouldAutorotate willRotateToInterfaceOrientation:toInterfaceOrientation持续时间:持续时间 willAnimateRotationToInterfaceOrientation:interfaceOrientation持续时间:持续时间
凌驾
shouldAutorotate shouldAutorotateToInterfaceOrientation:interfaceOrientation
使它们在rootViewController中返回NO/YES,并以所需的方式设置允许的方向,使用
supportedInterfaceOrientations
(无论是在rootViewCOntroller还是在最后一个视图中),我都得到了以下结果:
我用错误的方式做什么?预先感谢您的帮助
发布于 2013-04-27 05:22:13
将这些添加到您的viewController中,并让我知道它是否有效。
// iOS5旋转
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}// iOS6旋转
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotate
{
return YES;
}https://stackoverflow.com/questions/16246402
复制相似问题