首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UITableViewController subView旋转

UITableViewController subView旋转
EN

Stack Overflow用户
提问于 2013-04-26 22:57:39
回答 1查看 194关注 0票数 0

我对堆栈溢出和objective编程都很陌生。我已经搜索了下面描述的问题,但我无法找到一个可行的解决方案。

我的应用程序是一个简单的离线浏览应用程序,具有导航结构。在appDelegate中,我以下列方式之一加载RootViewController (UITableViewController):

A

代码语言:javascript
复制
   [window addSubview:navigationController.view];
   [window makeKeyAndVisible];
   return YES;

溶液B

代码语言:javascript
复制
   RootViewController* rootviewcontroller = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];    
   navigationController = [[UINavigationController alloc] initWithRootViewController:rootviewcontroller];

rootViewController只是简单地推送一些视图,即

代码语言:javascript
复制
 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还是在最后一个视图中),我都得到了以下结果:

  • 如果我使用解决方案A,所有视图都不会旋转。
  • 如果我使用解决方案B,所有视图都会旋转。

我用错误的方式做什么?预先感谢您的帮助

EN

回答 1

Stack Overflow用户

发布于 2013-04-27 05:22:13

将这些添加到您的viewController中,并让我知道它是否有效。

// iOS5旋转

代码语言:javascript
复制
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

// iOS6旋转

代码语言:javascript
复制
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (BOOL)shouldAutorotate
{
    return YES;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16246402

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档