0

I'm making a simple iOS app in xcode using Swift and while I have the entire backend figured out (and it works perfectly), I don't understand constraints AT ALL. I'm trying to make my layout adaptive so it works on all iphone screens but I'm having a really difficult time. Any suggestions on how I can create the perfect layout? Resources would be helpful too. Most resources don't explain the concept or start from scratch.

Another issue I'm having is that every time I click on something, e.g. a table cell, and uncheck "Constrain to margins" and set the constraints, the changes aren't saved and as soon as I hit enter they revert back to the original settings.

REALLY lost on this whole constraints thing. Thanks!

blob12
  • 141
  • 2
  • 12

1 Answers1

1

So for learning constraints, I would advice you to do this tutorial. It is lengthy but it covers a lot of important concepts.

www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2

As for constraint to margins, you need to deselect "constraint to margins" before you edit the values. And once you edit a value, make sure the red lines are activated, and do not click on add constraints until you are sure of all the values. (1)

(Image 1)

You can check and edit the constraint in this window, just select your view and go here (2)

(image 2)

ウィエム
  • 405
  • 4
  • 12