[英]ios7 iPad wrong view size in Landscape mode
I have iPad application which uses iOS7 SDK with auto-layout. 我有一个iPad应用程序,它使用带有自动布局的iOS7 SDK。 my main view have a sub view which is a UITabBarController which programmatically creates it's view controller's (storyboard.instaniateViewController..). 我的主视图有一个子视图,它是一个UITabBarController,它以编程方式创建了它的视图控制器(storyboard.instaniateViewController ..)。
Inside the views - when i'm in portrait mode - everything is fine. 在视图内部-当我处于纵向模式时-一切都很好。 but when i move to landscape mode - the view's width is changed correctly, but the view's height remains as in Portrait mode. 但是当我转到横向模式时-视图的宽度已正确更改,但视图的高度仍保持与纵向模式相同。 The result is that my screen is truncated in a height. 结果是我的屏幕被截断了。
Any ideas why it happens? 任何想法为什么会发生? constrains seems fine. 约束似乎很好。 I can change it by programmatically change the vie's frame, but it doesn't seem right. 我可以通过编程方式更改vie的框架来更改它,但这似乎并不正确。
Thanks 谢谢
OK, i see what the problem was - somewhere up the view's hierarchy was defined: 好的,我明白了问题所在-在视图层次结构的上方定义了某个地方:
[viewController.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth]
and that meant that the height was not flexible of course. 这意味着高度当然不灵活。 the fix is easy once i saw it: 一旦我看到它,修复就很容易了:
[viewController.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.