Hi all,
I've been using auto layout but I'm not an expert yet. I always have this question that I'm not sure of the answer. Please share your thoughts.
Obviously, when you write an app, you can't just put every view in the interface build and then add constraints to them all. There're views that being dynamically generated at run time and "addSubView". What I've been doing is add static views & constraints, then add dynamic views at run time and programatically add constraints to them and hide static views as needed. Is there any other way of doing things like this?
For example: I have a UIButton in the beginning. The user can tap on it and it'll slide to the left (and still visible) to show 3 additional UILabels (to the right of the button). I obviously need to programatically add constraints to the new labels. Then the user can tap on the same button again and it'll slide back to its original position and the 3 labels are removed.
Is there a better way than just manually adding/removing constraints so that static and dynamic views can work together in harmony? 😢
Thanks all.