iPhone 4& 5自动调整垂直空间 [英] iPhone 4 & 5 Autoresize Vertical Space

查看:149
本文介绍了iPhone 4& 5自动调整垂直空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Interface Builder for iPhone 4维度中构建了我的视图。我认为iOS 6中的Autoresize Constraints会自动处理大小调整。屏幕截图显示了Xcode自动添加的Top Space约束。它说顶部和底部橙色视图之间的关系必须是332点。

I built my views in Interface Builder for iPhone 4 dimensions. I thought that the Autoresize Constraints in iOS 6 will take care of the resizing automatically. The screenshot shows the Top Space constraint that Xcode added automatically. It says that the relationship between the top and the bottom orange view must be 332 points.

在iPhone 5中查看时,橙色按钮一直延伸到底部,如您所见截图如下。

When viewed in iPhone 5, the orange button is stretched all the way to the bottom as you can see in the screenshot below.

将关系更改为大于或等于时,视图不会更改并保持不变。删除常量以使其为自动时,视图将在整个屏幕上拉伸。如何指定高度为44点且位于底部的约束?

When changing the relation to Greater Than or Equal, the view does not change and remains the same. When removing the constant to make it Auto, the view is stretched across the entire screen. How do I specify a constraint were the height is 44 points and at the bottom?

推荐答案

没有约束超级视图的顶部。将其固定到超视图的底部,并将高度固定为44,然后删除将其链接到视图顶部的约束。

Don't have a constraint to the top of the superview. Pin it to the bottom of the superview, and fix the height to 44, then delete the constraint linking it to the top of the view.

通过选择相关视图并使用界面构建器中的固定菜单(浮动菜单上有三个图标,或者编辑器 - >来自菜单栏)。

You achieve the pinning by selecting the view in question and using the pinning menu in interface builder (the floating menu with three icons on it, or editor-->pin from the menu bar).

要在3.5到4英寸显示屏之间移动,您需要将内容链接到超级视图的正确边缘。底部的东西应该粘在底部。

To move between 3.5 and 4 inch displays, you need to link content to the correct edge of the superview. Stuff at the bottom should be stuck to the bottom.

我在界面构建器中写过关于约束编辑的文章这里如果你有兴趣的话。

I have written about constraint editing in interface builder here if you're interested.

这篇关于iPhone 4& 5自动调整垂直空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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