4

I am doing xamarin.ios and I am doing the UI i.e autolayout in xcode.

In xcode preview ... I am able to see the UI is good but in the device in some of the devices UI is not as it appears in preview.

such as iPhone 5s,iPhone 6s plus.

Can somebody explain me on why it happens and how to fix this

thanks

Sharath
  • 275
  • 1
  • 18
  • 3
    Could you please provide more info about issue you get. Specifically, what the result looks like? Is UI completely messed or just doesn't 'stretch' to bigger screens? – 0xNSHuman Apr 02 '17 at 11:52
  • 1
    I have a mother view which is 20 px away from top and bottom view .. I have done it using top and bottom vertical spacing to layout guide but the bottom view vertical spacing in iphone 5s it appears like 100 px away – Sharath Apr 04 '17 at 00:32

1 Answers1

0

There is a lot of reasons causing autolayout errors. Some of them because of different screen ratio, some of them because of different iOS versions.

You shold look into your debugger output and check for messages like this:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
    "<NSLayoutConstraint:0x7fc82d3e18a0 H:[UIView:0x7fc82aba1210(768)]>",
    "<NSLayoutConstraint:0x7fc82d6369e0 H:[UIView:0x7fc82aba1210]-(0)-|   (Names: '|':UIView:0x7fc82d6b9f80 )>",
    "<NSLayoutConstraint:0x7fc82d636a30 H:|-(0)-[UIView:0x7fc82aba1210]   (Names: '|':UIView:0x7fc82d6b9f80 )>",
    "<NSLayoutConstraint:0x7fc82d3e7fd0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fc82d6b9f80(50)]>"
)

Than just debug it.

ad1Dima
  • 3,185
  • 2
  • 26
  • 37