xcode 在横向模式下使用 Interface Builder 进行编程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/589711/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:29:29  来源:igfitidea点击:

Programming with Interface Builder in Landscape mode

iphonexcodecocoa-touchinterface-builder

提问by Jyotsna

I want to design an application by using Interface Builder, in Landscape mode. I don't know how to put the controls suitable to the Landscape mode. All I know I m rotating my UIView by using self.transform. I am new in it. So can anyone help me.

我想在横向模式下使用 Interface Builder 设计一个应用程序。我不知道如何放置适合横向模式的控件。我只知道我正在使用 self.transform 旋转我的 UIView。我是新手。所以任何人都可以帮助我。

回答by nduplessis

Not sure if this is answering your question but you can rotate the views in IB to show in landscape mode by click on the arrow in the top right corner

不确定这是否能回答您的问题,但您可以通过单击右上角的箭头旋转 IB 中的视图以在横向模式下显示

See the image IB landscape

看图 IB风景

回答by MattyG

I realize this is a bit old, but in Xcode4+ I can't see any rotation arrows. So instead, open your .xib > go to Simulated Metrics > Orientation > Landscape. Like this:

我意识到这有点旧,但在 Xcode4+ 中我看不到任何旋转箭头。因此,相反,打开您的 .xib > 转到 Simulated Metrics > Orientation > Landscape。像这样:

enter image description here

在此处输入图片说明

If you can't see the Simulated Metrics option, make sure your view is selected in the object hierarchy:

如果您看不到 Simulated Metrics 选项,请确保在对象层次结构中选择了您的视图:

enter image description here

在此处输入图片说明

回答by rustyshelf

Short answer is (as far as I know) that there is no easy way to do it currently:

简短的回答是(据我所知)目前没有简单的方法可以做到:

What's the best way to handle landscape/portrait differences in IB?

处理 IB 中横向/纵向差异的最佳方法是什么?