iPhone故事板:肖像和风景的不同场景 [英] iPhone Storyboard: different scene for portrait and landscape

查看:103
本文介绍了iPhone故事板:肖像和风景的不同场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你向下滚动 Apple Developer Page 您将找到创建备用横向界面部分。这里描述的基本方法是在方向改变时将不同的NIB文件呈现为模态视图。我正在使用Storyboard功能,所以我没有NIB。在这种情况下如何加载不同的场景?

If you scroll down a bit at this Apple Developer Page you'll find the section "Creating an Alternate Landscape Interface". The basic approach described there is to present a different NIB file as a modal view when orientation changes. I am using the Storyboard feature, so I don't have NIBs. How do I load a different "scene" in that case?

除此之外,我使用的是Tab Bar控制器,我不想显示模态视图。我只想用一个用界面构建器设计的横向视图替换当前的纵向视图,并保留我的标签栏。什么是Storyboard实现创建备用横向界面任务的方法?谢谢。

Besides that, I am using a Tab Bar controller, I don't want to show a modal view. I just want to replace the current portrait view with a landscape view designed with interface builder and keep my tab bar. What would be the Storyboard way to achieve the task "Creating an Alternate Landscape Interface"? Thank you.

推荐答案

当您将视图控制器添加到故事板时,它会附带一个视图。调用容器视图。向容器视图添加两个视图:纵向视图和横向视图。使用尺寸检查器适当地设置纵向视图和横向视图的尺寸。根据应用程序的需要,为纵向和横向视图添加按钮,更多视图,标签或其他内容。然后当方向改变时隐藏一个视图并显示另一个视图。

When you add a view controller to the storyboard it comes with a view. Call that the container view. Add two views to the container view: a portrait view and a landscape view. Set the dimension of the portrait view and the landscape view appropriately using the size inspector. Add buttons, more views, labels or whatever to the portrait and landscape views as needed for your application. Then when the orientation changes hide one view and show the other.

这篇关于iPhone故事板:肖像和风景的不同场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆