简体   繁体   中英

Problems with scaling interface from a device to another in iOS

This issue is really frustrating and getting me crazy.

I've read everything about AutoLayout and so on, but it happens all the time. My interface has a view with an image view as background and a smaller subview on top of it (corresponding to a field in my image). I've tried everything but it looks like the subview does not scale accordingly with my image when switching through devices. By the way, the IB preview does not show what i real get when running the iOS Simulator, is that normal? Why? What do i do wrong? I'm not sure what else to try!

http://i58.tinypic.com/34xqtc6.png

EDIT: i cannot post images :(

I have setup a githubrepo regarding your case, kindly have a look https://github.com/usamaiqbal83/TestingProject

在此处输入图片说明

Constraints for Background Image View:

在此处输入图片说明

Constraints for Front View

在此处输入图片说明

the most important thing to remember is ofcourse the constraint equation

FirstItem.Attribute1 = (SecondItem.Attribute2 * Multiplier) + Constant

Instead of subview use Container View.

在此处输入图片说明

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