如何设置水平文本字段的自动布局风景模式? [英] How to set Horizontal text field in landscape mode with auto layout?

查看:158
本文介绍了如何设置水平文本字段的自动布局风景模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我想根据在横向模式下的屏幕尺寸设置文本字段宽度,使用自动layout.it的工作画像完美地景观模式下无法正常工作。

In my app i want to set text field width according screen size in landscape mode,using auto layout.it's working portrait perfectly in land scape mode not working.

下面是我的屏幕,支持自动布局,

Here is my Screen with auto layout,

在这里输入的形象描述

在横向模式下显示出这个样子,

In landscape mode showing like this,

在这里输入的形象描述

下面是我的约束屏幕

在这里输入的形象描述

这我的视图控制器

在这里输入的形象描述

推荐答案

我想你必须有这样的布局有明确设定宽度下的一些上海华。

I suppose you must have some superview under this layout that has explicit width set.

如何看待当你调整模拟指标,比如在你的故事板的大小和方向是怎样的?
ALSE记得要仔细检查视图层次。

How does it look like when you tweak simulated metrics like size and orientation in your storyboard? Alse remember to double check the view hierarchy.

检查大小检查,你的约束上应该是:
尾随空间上海华,导致空间的SuperView,有的顶部和底部的空间。而没有设置明确的宽度值

Check the size inspector, your contraints should be: trailing space to superview, leading space to superview, and some top and bottom space. And don't set explicit width value

编辑:正如你所看到的,这是你的文本框的上海华,实际上整个布局来看,有明确设置宽度值。删除此值,而是同时设置尾随和前导空格。这会工作

As you can see, the view which is the superview for your textfields and actually whole layout, has the explicitly set width value. Delete this value and instead set both trailing and leading space. This would work

这篇关于如何设置水平文本字段的自动布局风景模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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