3 ms·
Dealing with auto layout is probably my least favorite aspect of iOS dev, but I wouldn't recommend doing layout by hand. There are just too many variables to co
by cageface 9y ago
Dealing with auto layout is probably my least favorite aspect of iOS dev, but I wouldn't recommend doing layout by hand. There are just too many variables to consider to write really robust manual layouts.
That said I'm really disappointed with UIStackView. When it was first announced it seemed like a great solution to a lot of common layout problems but in practice I've found it tends to cause as many problems as it solves and now I mostly just use it when I need a clean way to hide & reveal various UI elements dynamically. I'd take some variant of flexbox over all this any day.
- nielsbot 9y agoI do think auto-layout could be fixed with better a) design tools and b) visualization, test and debug tools.
- oculusthrift 9y agoi just use pure nslayoutconstraints and don’t have to deal with uibuilder. i find it pretty easy. especially if you code yourself some helper functions for it
- krzat 9y agoWhat problems did you have with UIStackView?
- cageface 9y agoAdding or hiding elements often causes layout conflicts, because UIStackView adds a new constraint at 1000 priority. You have to work around this by bumping one of the other constraints down to 999. Also recent versions of interface builder tend to complete fail at rendering nested stack views, even though the layouts work fine when you actually run the app.