Constraints to be set for x position

限于喜欢 提交于 2020-01-25 04:01:27

问题


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.

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

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

Any solution?


回答1:


1) Embed your 4 circle in UIView.

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

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



来源:https://stackoverflow.com/questions/38321280/constraints-to-be-set-for-x-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!