Kodeco Forums

Video Tutorial: Adaptive Layout Part 3: Views

Learn how to adjust your layout by adding or removing a view to allow for the best use of space in your layout.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3187-adaptive-layout/lessons/4

I don’t fully understand the bug fix code. I’m still wrapping my head around it. But is this boilerplate code that will work for any situation where we remove views in specific size classes?

If you’re using a stack view and seeing the bug, you can use this same pattern to workaround the bug. I haven’t had a chance to test in the latest beta to see if the bug still exists. If you aren’t using stack view, you shouldn’t need the bug fix code.

Tried using a stack view for the first time in Xcode 7.3 (current latest) and Xcode went slow and started crashing. Nothing I did, even undoing the stack view made a difference until I completely reversed all changes with version control.

Ironically I’m now using them ok and stably since the reversion. Though Xcode is a bit slow when changing view classes, that is something that has always been an issue for me.

Anyone else had these issues?

I’m using a 2014 15" MBP 16GB RAM, i7 and GT750… I wouldn’t have expected these issues with such a powerful system.

How to instal/uninstall the UIView and NSLayoutConstraints programmatically based on size class.

Trait collections (covered in video 6) are really the way to do this. They let you see what the size class is in code.