【问题标题】:When rotating my viewController, the status bar doesn't rotate with the with. How to fix it?旋转我的 viewController 时,状态栏不会随 with 一起旋转。如何解决?
【发布时间】:2013-05-14 10:07:16
【问题描述】:

每个人。我有一个 iOS6 ipad 应用程序要更新。我遇到的问题是只有一个视图控制器需要自动旋转,我没有找到正确的方法来做到这一点。

我已经尝试了以下链接,它在一定程度上有所帮助: Only having one view autorotate in xcode?

但是当我旋转 viewController 时,它的状态栏不会随视图一起旋转,并且视图的标题也不会像我设置的那样停留在中心。

我在viewController中加了断点,发现只有在设备是横向的时候才会调用- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

我想知道是否有人可以告诉我错误隐藏在哪里以及如何修复它。 谢谢转发。

【问题讨论】:

  • 这个问题的状态是什么?解决了吗?顺便说一句,我没有得到你想要的。
  • 这是一个自转错误,已经解决。谢谢你的提问。 :)
  • 如果您关闭这个问题或者只是提出解决方案并且除了您自己的答案之外,这将是一件好事。其余是您的愿望。
  • 感谢您的建议。我会这样做的。

标签: objective-c ios6 uiinterfaceorientation


【解决方案1】:

我已经解决了这个问题。我的错误是我在设置自动旋转问题时在下面添加了一些单词。

CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(0));
landscapeTransform = CGAffineTransformTranslate (landscapeTransform, 0.0, 0.0);

self.view.bounds = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, 768, 1024);

if (isVisible == NO) return; // iOS present modal bodge
[self updateScrollViewContentViews]; // Update content views
lastAppearSize = CGSizeZero; // Reset view size tracking

[self.view setTransform:landscapeTransform];

我删除了这些手动词,并留下以下方法。完成了。

-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 2012-09-13
    • 1970-01-01
    相关资源
    最近更新 更多