在iOS中将屏幕从纵向旋转为横向时,如何获取textView展开 [英] How do I get a textView to expand when screen is rotated from portrait to landscape in iOS

查看:40
本文介绍了在iOS中将屏幕从纵向旋转为横向时,如何获取textView展开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Interface Builder创建此UI:

当它是纵向时,一个和两个TextView会填满屏幕的宽度(这是我想要的),但是当我将其旋转到横向模式时,TextView不会占据整个屏幕的宽度./p>

在横向模式下,如何获取TextView来填充屏幕的宽度?在界面生成器"中,选中了自动布局"选项,如果可能的话,我仍然希望选中它,因为其他所有方法都可以很好地使用它.因为我还是iOS编程的新手,所以任何建议都将不胜感激.

现在屏幕截图发布在下面.例如,如果您注意到文本框一"一直到肖像视图中的边缘,而不是在风景视图中.

解决方案

如果您不想使用自动版式,则可以使用以下步骤.

1)在您的XIB中,取消选中自动布局"复选框.

2)选择您的TextField并按如下所示设置autoResizeConstraints.

这个....它将为您提供帮助....

I am using the Interface Builder to create this UI:

And when it is in portrait the One and Two TextViews fill the width of the screen (which is what I want), but when I rotate it to landscape mode the TextViews do not take up the full width of the screen.

How can I get the TextViews to fill the width of the screen in landscape mode? In the Interface Builder, the "Autolayout" option is checked and if possible I would like to accomplish this with it still checked since everything else works best with it on. Any advice would be greatly appreciated since I am still fairly new to iOS programming.

Now the screenshots are posted below. If you notice text box One for example goes all the way to the edge in Portrait view, but not in Landscape view.

解决方案

If you dont want to use AutoLayout, You can use following steps.

1) In your XIB uncheck autoLayout check box.

2) Select your TextField and set autoResizeConstraints as follows.

Tyr this .... It will help you....

这篇关于在iOS中将屏幕从纵向旋转为横向时,如何获取textView展开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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