如何在IOS X code上创建多个标签之间的间距相等使用自动版式约束6.3 [英] How to create equal spacing between multiple label in ios xcode 6.3 using AutoLayout Constraints

查看:420
本文介绍了如何在IOS X code上创建多个标签之间的间距相等使用自动版式约束6.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能实现多个标签的自动布局如图图片

How can I implement auto layout for multiple label as shown in image

我需要保持所有的标签和侧空间之间的相对间距相等了。我想保持标签1,2,3,4之间的间距相等。我无法保持标签使用自动版式多个iPhone版本之间的相对间距相等。

I need to maintain relative equal spacing between all label and side space too. I want to maintain equal spacing between label 1,2,3,4. I am unable to maintain relative equal spacing between the labels for multiple iPhone versions using AutoLayout.

我可以使用以下步骤来解决:

I was able to solve using following steps:

第一步:将要在视图中创建标签或按钮,
  给下面这种观点的约束:

Step1: Place the label or button you want to create inside a view and give that view constraint as below:

第二步:选择你要创建的标签或按钮,并设置
  约束如下:

Step2: Select all the label or button you want to create and set constraint as below:

起初

在第二个

在第三个

推荐答案

苹果公司为您所面临的问题的一个极好的例子和说明。你可以找到解决办法<一href=\"https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html#//apple_ref/doc/uid/TP40010853-CH5-SW8\"相对=nofollow>这里。

Apple has an excellent example and explanation for the problem that you are facing. You can find the solution here.

他们使用辅助视图的可见视图之间的间距称为间隔意见。

They use auxiliary views for spacing called spacer views between the visible views.

希望它帮助。 :)

这篇关于如何在IOS X code上创建多个标签之间的间距相等使用自动版式约束6.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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