iPhone 在旋转问题上调整 UIView 大小
我在 IB 中以纵向模式设置我的主视图(适用于 iPad)。我有一个工具栏、一个地图视图(x=0、y=44、w=768、h=774)和页脚视图(x=0、y=818、w=768、h=186)。
当我旋转 iPad 时,我希望地图保持在左侧并垂直调整大小以适合视图(x=0、y=44、w=756、h=704)并将页脚视图放在右侧(x=0,y=818,w=768,h=186)并且也垂直延伸。
无论如何,效果与WeatherBug应用程序完全相同。我不知道他们是如何做到这一点的,但是他们包含信息的视图与 UIScrollView 和 UIPageView 旋转 90 度,我有基本相同的需求,但真的不知道如何做到这一点。他们的所有东西都在同一个 xib 中吗?我很困惑...
请告诉我您是否知道如何做/组织这样的视图! 谢谢...
I setup in IB in portrait mode my main view (for iPad). I have a toolbar, a map view (x=0, y=44, w=768, h=774) and a footer view (x=0, y=818, w=768, h=186).
When I rotate the iPad, I want the map to stay on the left side and be resized vertically to fit the view (x=0, y=44, w=756, h=704) and put the footer view on the right side (x=0, y=818, w=768, h=186) and extend vertically too.
Anyway, the effect is exactly the same as the WeatherBug application. I don't know how they do that, but their view containing the information is rotating by 90 degrees with the UIScrollView and UIPageView, I have basically the same needs and really don't know how to make this. Do they have everything in the same xib? I'm so confused...
Please tell me if you know how to do/organize a such view!
Thank you...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望地图保持在左侧并能够垂直调整大小,请按如下方式设置其 autoresizingMask:mapView.autoresizingMask = UIViewAutoresizingMaskFlexibleRightMargin | UIViewAutoresizingMaskFlexibleHeight;
我不明白你希望 footerView 如何调整大小(横向模式下的 y=818 不在可见视图之外)。
您应该阅读 UIView 参考,特别是有关自动调整大小蒙版的部分(链接:http://developer.apple.com/iphone/library/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/ occ/instp/UIView/autoresizingMask )
If you want the map to stay against the left side and be able to resize vertically set its autoresizingMask as such:
mapView.autoresizingMask = UIViewAutoresizingMaskFlexibleRightMargin | UIViewAutoresizingMaskFlexibleHeight;
I don't understand how you want to footerView to resize through (y=818 in landscape mode is out of the visible view).
You should read the UIView reference, specifically the part regarding autoresizing mask (link: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/autoresizingMask )