UITabBar 未正确更新一个视图控制器的方向
我有一个 UITabBar,里面有 5 个视图控制器。当选择前四个控制器中的任何一个并且设备方向发生变化时,视图将正确更新。
但是,当最后一个控制器处于活动状态并且设备方向发生变化时,视图的框架不会正确地将其大小更新为新的框架大小,直到我选择另一个选项卡然后返回到第五个选项卡。视图已正确“旋转”,但由于其帧大小不正确而被设备剪裁。
另外,为了在提出问题之前回答问题,我在视图控制器中有以下代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return YES;
}
感谢您的帮助!
I have a UITabBar with 5 view controllers in it. When any of the first four controllers are selected and the device orientation changes, the view will correctly update.
However when the last controller is active and the device orientation changes, the frame of the view does not correctly update its size to the new frame size until I select another tab and then go back to the fifth tab. The view is "rotated" correctly, but it is clipped by the device because it has the incorrect frame size.
Also to answer a question before it is asked, I have the following code in the view controller:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return YES;
}
Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我不确定这是否是我的代码中的错误或问题,或者一切设置的方式,但我已经弄清楚了。
显然,对于我从添加到此 tabBarController 的 XIB 加载的任何视图,都会发生这种情况。我用其他几个视图进行了测试,只有从 XIB 添加视图时才会发生这种情况。我已经删除了它并从代码构建了所有内容,它现在似乎可以工作了。
Alright well I'm not sure if this is a bug or a problem in my code or the way everything is setup, BUT I've figured it out.
Apparently this happens for any view that I load from an XIB that's added to this tabBarController. I tested out with several other views and it only happened when views were added from XIBs. I've deleted that and built everything from code and it seems to be working now.