加载不同的纵向/横向 UIView
我有以下 View COntroller 结构:
ScrollViewController 景观视图控制器 PortraitViewController
每个都有自己的 .nib
该应用程序以横向模式启动,其中许多横向视图被添加到滚动视图中。每个横向视图都有其特定的纵向视图,因此我必须为每个视图分配类似的 ID。你能告诉我,如何在旋转设备时加载每个横向视图的特定纵向视图?
我必须制作两个滚动视图吗?一张拍风景,一张拍肖像?或者是否可以只滚动横向滚动视图并根据 ID 仅加载一个具有正确内容的纵向视图?我该如何实现呢?
数据来自属性列表。
提前致谢!
I have following View COntroller structure:
ScrollViewController
LandscapeViewController
PortraitViewController
Each with its own .nib
The app starts in landscape mode where many landscape views are added to a scrollview. Each landscape view has its specific portrait view, so I have to assign like ID's to each of this views. Can you tell me, how I can load the specific portrait view for each landscape view when rotating the device?
Do I have to make two scroll views? One for landscape, one for portrait? Or is it possible to just scroll through the landscape scrollview an load just one portrait view with the right content based on an ID? How could I implement that?
The data comes from a property list.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 UIViewController 中使用 shouldAutorotateToInterfaceOrientation 来提供您正在寻找的功能。在下面的示例中,我将切换视图以对应方向更改:
在您的情况下,您可以使用 shouldAutorotateToInterfaceOrientation 来调整视图大小或切换到相应的纵向视图。
希望有帮助。
You use the shouldAutorotateToInterfaceOrientation in your UIViewController to provide the functionality that you are looking for. In the example below I am switching the views to correspond to orientation changes:
In your case, you can use the shouldAutorotateToInterfaceOrientation to may be resize your views or switch to their corresponding portrait views.
Hope that helps.