Xcode constraints problem

Good afternoon. I have finished my app with a few buttons, the problem comes when I change the screen and switch to iphone 6 for example or any other screen.

I have tried many combinations, can you think of examples of constraints to suit? even if it's only inside iphones, I wouldn't mind doing the same for ipad.

enter the description of the image here

Forget the white box in the lower right corner.

 0
Author: Eslacuare, 2016-10-06

2 answers

Have you tried with Add Missing Constraints? On the Resolve Auto Layout Issues button.

enter the description of the image here

Clears the previous Constraints in the "Clear Constraints" option and then "Add Missing Constraints". That should help a little.

 0
Author: JWFollinCh, 2016-10-14 06:12:14

You should remove all constraints and static positioning of the elements that make up the screen and create dynamic constraints that allow you to position the elements based on the size of the screen.

For example, I would start with the top button placing it in the center of the screen. To do this you must go to the size Inspector and with the right button select the element to be positioned:

- TOP CENTER ICON:

  • " Center Horizontally in View " with View.
  • "Top Space to View" with View.

Bottom icons 1st row:

* left:

  • " Top " with top Center icon. (vertical space relative to the top icon)
  • "Leading Space to View" with View. (lateral space relative to view)

* Right:

  • " Top " with top Center icon. (vertical space relative to the top icon)
  • "Leading Space to View" with left icon 1st row. (space icon of the same row)

Bottom icons 2nd Row:

* left:

  • " Top " with bottom icon 1st row. (vertical space relative to the top row icon)
  • "Leading Space to View" with View. (lateral space relative to view)

* Right:

  • " Top " with bottom icon 1st row. (vertical space relative to the top row icon)
  • "Leading Space to View" with left icon 2nd Row. (side space relative to the icon of the same row)

This way you will be able to position the elements regardless of the size of the screen.

I hope it will be useful to you.

 0
Author: oremag14jf, 2016-10-14 11:27:48