关闭模态视图使主视图旋转
我有一个主视图,我使用
-(void)viewDidLoad {
self.view.transform = CGAffineTransformMakeRotation(90);
self.view.bounds = CGRectMake(-0.0, 0.0, 480.0, 320.0);
它旋转到横向,效果很好。问题是这个视图可以调用模态视图,当我关闭模态视图时,主视图返回到纵向。任何想法为什么会发生这种情况以及如何解决它?
I have a main view that I rotate to landscape using
-(void)viewDidLoad {
self.view.transform = CGAffineTransformMakeRotation(90);
self.view.bounds = CGRectMake(-0.0, 0.0, 480.0, 320.0);
It works great. The problem is that this view can call a modal view, and when I dismiss the modal view the main view returns to portrait. Any ideas why this happens and how can I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在主视图中覆盖
shouldAutorotateToInterfaceOrientation:
并针对任何方向返回YES
?如果没有,您的主视图认为它只能支持纵向模式,并且每当到达前面时就会自动旋转回纵向。Are you overriding
shouldAutorotateToInterfaceOrientation:
in your main view and returningYES
for any orientation? If not, your main view thinks that it can only support portrait mode, and will autorotate back to portrait whenever it comes to the front.