简体   繁体   中英

Auto layout constraints on iOS 8

I'm trying to apply this design I made with Sketch to my iOS app. 这是设计图片:在此处输入图片说明

在此处输入图片说明 On my storyboard it looks like the second picture. However, when I run the app on an iPhone 5s (without any constraints) it looks like the third picture. Which constraint should I add to the scene to make the card background image view centered as the concept; the icon imageView(in purple) centered X and Y; and all the other buttons and labels arranged in the sketch picture? Thank you

I believe your problem is that the purple image with the building in it is small which is resizing the UIImageView and then dragging the "Hello There" label down to it. First look at the Mode of your UIImageView . I believe the mode you want is "Aspect Fill", but if that doesn't work try "Scale To Fill" as shown below.

在此处输入图片说明

Also the first constraint I would add after trying the above is a vertical top constraint between the "Hello There" label and the SuperView. Then add 3 constraints around the UIImageView (top, left, right).

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