简体   繁体   English

iPhone 6 Plus及更高版本的Xcode约束和大小类

[英]Xcode constraint and size classes for iphone 6 plus and up

I wonder if there is any way to only target iphone 6 plus and up when it comes to size classes and constraints. 我不知道在尺寸类别和约束方面是否有任何方法只能将iphone 6 plus或更高版本作为目标。

Looking at this: 看这个: 在此处输入图片说明

I can't see it. 我看不到

I have a UIview with a spacing of 20pt on all sides. 我有一个UIview,所有侧面的间距均为20pt。 The UIView works as a container for a search form. UIView用作搜索表单的容器。 The UIView appears the same on all devices. UIView在所有设备上都相同。 But when it comes to Iphone 6 and up, the View appears to have some dead space in the bottom of the view. 但是当涉及到Iphone 6或更高版本时,View底部似乎有一些死角。 What I would like to do is to have a even space between all form items so that they take up the whole view. 我想做的是在所有表单项之间留一个均匀的空间,以便它们占据整个视图。

So is there any way to target iphone 6 and up? 那么,有什么方法可以定位iphone 6或更高版本吗? Eg making buttons bigger / adding more space between items 例如,使按钮更大/在项目之间增加更多空间

One way to do this is to constraint the height of the buttons/fields to this UIView, so they always take for example 1/10 of its height. 一种实现方法是将按钮/字段的高度限制在此UIView上,因此它们始终占用例如其高度的1/10。 On the storyboard right-click drag from a control to its superview and select Height to create a constraint. 在情节提要板上单击鼠标右键,将其从控件拖到其父视图,然后选择“高度”以创建约束。 Find this constraint and change it's multiplier from 1 to for example 1/10. 找到此约束并将其multiplier从1更改为例如1/10。 This is the way I did it and I found it way less time consuming than playing around with freeform sizes and other size classes. 这是我这样做的方法,并且我发现它比使用自由格式的尺寸和其他尺寸类要少得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM