X code 7自动布局约束:如何让2图像中心水平停留 [英] XCode 7 Autolayout Constraints: How to make 2 images stay horizontally in the center

查看:140
本文介绍了X code 7自动布局约束:如何让2图像中心水平停留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在屏幕的中央,并排位置2 UIImage的意见。如果只是1的UIImage,我可以将它们设置为在容器纵向和横向中心。如果我有2的UIImage并排方的意见,我只能将它设置为垂直居中,而不是水平居中因为两者的UIImage意见将堆放超过对方。

I'm trying to position 2 UIImage views in the center of the screen, side by side. If it's just 1 UIImage, I can just set them to be vertically and horizontally center in the container. If I have 2 UIImage views side by side, I can only set it to be vertically centered, but not horizontally centered since both UIImage views would stack over each other..

可能有人请引导我?感谢大大AP preciated!

Could someone please guide me ? Thanks and greatly appreciated!

推荐答案

以一个视图,把两个图像的视图内。加上这些图片的约束相对于你做(边到边的视图)的视图。现在添加视图上的约束就超级看法。 (中心垂直和水平)。这就是它!

Take a view, put both the images inside that view. Add the constraints on those images with respect to the view you made (Edge to edge to the view). Now add the constraints on the view in respect of the super view. (Center vertically and horizontally). That's it!

这篇关于X code 7自动布局约束:如何让2图像中心水平停留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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