X code 6 - 创建的UIImageView具有同等的高度与屏幕方向变化? [英] Xcode 6 - create UIImageView with equal heights changing with screen Orientation?
问题描述
为什么我的的UIImage
变化的高度时,我在不同的设备上运行呢?我将高度设置为187太所有4张图片,我想以同样的高度,显示他们,使他们充满整个屏幕?
Why doesn't the height of my UIImage
change when I run it on a different device? I set the height to 187 too all 4 images and I want display them with equal heights so they fill the full screen?
下面是每个图像的限制:
Here's the constraints for each image:
在右侧的图片是从X code截取的屏幕截图。左边的图片是在iPhone 6
The image on the right is a screen-shot taken from Xcode. The image on the left is a screen-shot on iPhone 6
推荐答案
的UIImage
的大小没有改变,因为它是相同的JPG / PNG文件,不管设备。你需要的是一组合适的布局约束。
UIImage
's size doesn't change because it's the same JPG/PNG file, regardless of the device. What you need is a set of proper layout constraints.
我建议以下办法:
- 连接第一图像视图的
顶
来上海华的顶
, - 连接最后一个图像视图的
底
来上海华的底
, - 设置
的高度相等
所有图像视图。
- Connect first image view's
top
to superview'stop
, - Connect last image view's
bottom
to superview'sbottom
, - Set
equal heights
for all image views.
哦,不要忘了设置一些限制为水平轴。
Oh, and don't forget to set some constraints for horizontal axis.
这篇关于X code 6 - 创建的UIImageView具有同等的高度与屏幕方向变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!