I've been struggling with auto-layout for about six months now. I finally get it but there's a certain impedance mismatch between how you want your elements to be laid out and what constraints are required to achieve the same result. Humans beings aren't wired to intuitively think like a constraint solver.
I'm not an experienced developer but my thinking on this issue is that the platform should provide some functionality to achieve the most common boiler-plate layouts and anything more complex should be written in code.
Usually constraints are simple and so are the layouts. But to achieve more complex layouts you need constraints which are at cross purposes to each other but have different priorities. It's not intuitive to work through this stuff.
Here's an example :
http://stackoverflow.com/questions/25766747/emulating-aspect...
The answer there is great but tell me , you could have aspect fitted the view to it's parent in just four lines of code instead of going through this confusing series of constraints.
I was making a tic tac toe game and I decided to try and draw the boxes and lines using auto layout. The constraints were making me tear my hair out and finally I wrote 5 lines of custom layout code and it took me only ten minutes and this was after futzing about with the constraints for half an hour and it did what I wanted to on an iPhone , iPad and for any height or width.
I personally believe in a simplified version of FlexBox for common cases (yes I think it needs to be even simpler) and custom code for anything more complex.
Bringing in all the baggage of a constraint solver to do your layout is like trying to use an Abrams Tank to kill a mouse.
10 designer creates an initial mock-up
20 designer re-sizes the window / uses another device
30 designer alters the style on that new format, re-sizing boxes, changing font sizes, etc.
40 constraint solver finds a minimal set of constraints consistent with the designer wishes
50 goto 20
http://stackoverflow.com/questions/28550692/auto-layout-of-v...
The correct answer (for desktop) is canonical grid based layout. (1)
I created DesignGridLayout, a manager for Java Swing. You add rows of widgets, the manager figures out optimal placement.
https://designgridlayout.java.net/grids.html
Every time I see mention of grids and CSS, I get a little bit excited. Then I see it's not based on canonical grids and I leave sad.
Maybe I should have "ported" DGL to HTML/CSS/JS, but I haven't figured out how (yet).
For mobile, I reserve judgement. I've heard good things about AutoLayout. But it'll be hard to replace my strategy of creating custom managers as needed.
(1) Except maybe for dynamic insertion and removal of controls. I'd have consider a few cases.
Maybe a hybrid approach would be best? Constraint-based for the broad strokes and then regular box-based layout within these blocks.
[1]: https://github.com/archagon/ABExpandingViewController/blob/m...
Compared to previous experience with Qt, I don't see any advantage of constraint-based layout over box-based layout.