How to fix the layout bug in the official iOS app development guide?

201 views Asked by At

I'm following the official iOS app development guide. In "Implement a Custom Control" section, after completing "Add Support for Interface Builder" sub-section and re-building the project, I am still getting layout errors in the Interface Builder:

enter image description here

enter image description here

What is the reason for this error and how can I fix this?

1

There are 1 answers

0
Utku On BEST ANSWER

The reason is that your outer stack view's "Alignment" property is set to "Fill", whereas it should be set to "Leading". In other words, set the "Alignment" property of your outer stack view to "Leading" in order to fix this problem.

The problem is, the guide never mentions about this explicitly. In "Build a Basic UI" section, there is this image:

enter image description here

that shows the "Alignment" property of the outer stack view as "Leading". However, it is never explicitly mentioned that the "Alignment" property of the outer stack view should be set to "Leading", instead of "Fill".