iPad 添加视图,然后告诉它根据方向模式调整大小?
新编辑:
我已将问题范围缩小到此 - 我有一个视图添加到我的主视图中。该视图是纵向的 nib 文件。该视图可以以横向或纵向模式添加。将其添加为子视图后,我如何告诉它,设备现在处于横向模式,您应该自动调整大小以适应?
老的: /* 我有一个视图,是通过 [NSBundle mainBundle] loadNibNamed 加载的。当按下“显示”按钮时,视图应该显示,同样,当按下“隐藏”按钮时,视图应该隐藏。这工作正常。
问题出在设备方向改变时(比如从纵向模式改为横向模式)。如果显示视图,则其大小调整正常,并且一切正常。但是,如果视图被隐藏,并且我旋转设备并按显示,则会显示视图,但不会调整为新布局。它保留了原来的尺寸。
这是因为自动调整大小仅适用于可见组件。有没有办法强制调整视图大小? */
NEW EDIT:
I have narrowed my problem to this - i have a view that i add to my main view. That view is nib file in portrait orientation. That view can be added both in landscape or portrait mode. After adding it as subview how do i tell it, device is now in landscape mode, you should autoresize to fit?
OLD:
/*
I have a view, that is loaded via [NSBundle mainBundle] loadNibNamed. When button show is pressed view should show, and likewise when button hide is pressed view should hide. And this works ok.
Problem is with when device orientation is changed (lets say from portrait to landscape mode). If view is shown it resizes ok, and everything works fine. But if view is hidden, and i rotate the device and press show, view is shown, but not adjusted to new layout. It retains its original dimensions.
It is as automatic resizing is only applied to visible components. Is there some way to force resizing of the view?
*/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加视图时,请使用以下命令:
When you add your view, use the following: