Search code examples
iosswiftautolayoutadaptive-ui

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 :(


Solution

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

    enter image description here

    Constraints for Background Image View:

    enter image description here

    Constraints for Front View

    enter image description here

    the most important thing to remember is ofcourse the constraint equation

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