简体   繁体   中英

How to properly size an object using constraints in Xcode 6?

I'm fairly new to Xcode and I am trying to create a simple app that is universal to support all iPhone screen sizes.

I'm testing this on an iPhone 5 screen and iPhone 6 screen.

I have the following constraints for the background UIImageView object, which expands to support both screen sizes perfectly.

在此处输入图片说明

For the View object colored in gray, I set the following constraints:

在此处输入图片说明

However, when I tested it on my iPhone 5 and iPhone 6, the View object remains the same size. It doesn't resize proportionate to both phone screen sizes because you can see how much space the View object takes as shown:

在此处输入图片说明在此处输入图片说明

Is there any way to fix this?

Thanks!

对于灰度视图,除了CEnterX和CenterY之外,您还需要定义高度约束以及前导空间和0常量的尾随零。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM