为x位置设置的约束 [英] Constraints to be set for x position

查看:124
本文介绍了为x位置设置的约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,其中我必须显示四个圆圈.这些应该在屏幕的中央.我试图放置x和top约束,但这不适用于iPhone 4设备.

I've a scenario where in I've to display four circles. These should be in center of screen. I tried to place x and top constraint but this doesn't works fine for iPhone 4 device.

我应该设置哪些约束条件,以便所有iPhone设备的所有四个圆圈都出现在中心?

What constraints should I set so that all four circles should appear in center for all iPhone device?

此外,底部有UICollectionView.我试图设置顶部,左侧,左侧和右侧,但这没有用.

Further, there is UICollectionView in bottom. I tried to set the top, left, w and height but this didn't worked.

有解决方案吗?

推荐答案

1)将第4个圆圈嵌入UIView.

1) Embed your 4 circle in UIView.

2)设置UIView约束顶部,固定宽度,固定高度和水平中心

2) Set UIView constraint top, fixed width,fixed height and horizontal center

3)现在选择所有4个圆并设置约束,例如顶部,前导,尾部,底部和等宽.

3) Now Select all 4 circle and set constraint like top, leading,trailing,bottom and equal width.

这篇关于为x位置设置的约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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