X code 6 - 创建的UIImageView具有同等的高度与屏幕方向变化? [英] Xcode 6 - create UIImageView with equal heights changing with screen Orientation?

查看:187
本文介绍了X code 6 - 创建的UIImageView具有同等的高度与屏幕方向变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我的的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.

我建议以下办法:


  1. 连接第一图像视图的来上海华的

  2. 连接最后一个图像视图的来上海华的

  3. 设置的高度相等所有图像视图。

  1. Connect first image view's top to superview's top,
  2. Connect last image view's bottom to superview's bottom,
  3. Set equal heights for all image views.

哦,不要忘了设置一些限制为水平轴。

Oh, and don't forget to set some constraints for horizontal axis.

这篇关于X code 6 - 创建的UIImageView具有同等的高度与屏幕方向变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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