为什么子视图在 InterfaceRotation 之后会调整大小?
我正在向主视图控制器的 UiView 添加一个子视图,该子视图的呈现方式与具有 Formsheet 样式的 UIModalViewController 类似。 (所以它不会填充整个屏幕)
不,如果设备旋转子视图以某种方式调整大小以填充整个主视图...... 即使我手动设置:
subViewCtrl.view.autoresizingMask = UIViewAutoresizingNone;
它仍然会自动调整大小。 为什么它不能像其他子视图那样简单地停留在中间?
I'm adding a subview to the UiView of my mainviewcontroller, that is presented in a similar way as a UIModalViewController with the Formsheet-style. (so it doesn't fill teh whole screen)
No if the device rotates the subview somehow gets resized to fill the whole mainview...
Even if I manually set:
subViewCtrl.view.autoresizingMask = UIViewAutoresizingNone;
it still autoresizes.
Why can't it simple stay in the middle as any other subview would?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我自己想出来了。
我不小心
这样做了,所以我也改变了它
,它按预期工作了。无论如何,谢谢!
当然,还需要设置一下
,否则界面旋转时无法正确居中。
Ok, I figured it out myself.
I accidentally did
so I changed this too
and it worked as intended. Thanks anyway!
Of course, then one also has to set
otherwise it doesn't get centered properly when the interface rotates.
视图的大小是否正在调整,或者视图在屏幕尺寸发生变化时保持相同的大小?您可能需要 UIViewAutoresizingFlexibleWidth 和/或 UIViewResizingFlexibleHeight。如果您使用这些值,那么您的子视图将调整大小以与屏幕边缘保持恒定距离;您的视图将改变大小,但保持居中。
Is the view resizing, or is the view staying the same size while the dimensions of the screen change? You may want UIViewAutoresizingFlexibleWidth and/or UIViewResizingFlexibleHeight. If you use those values then your subview will resize to remain a constant distance from the edges of the screen; your view will change sizes, but remain centered.