search by tags

for the user

adventures into the land of the command line

reloading the ui in iOS

a nicer, more complete writeup here, but here’s a quick summary for myself.

setNeedsLayout()

Asynchronous - tells the system that you want it to layout and redraw that view and all of its subviews, when it is time for the update cycle. This is an asynchronous activity, because the method completes and returns immediately, but it isn’t until some later time that the layout and redraw actually happens, and you don’t know when that update cycle will be.

layoutIfNeeded()

Synchronous - tells the system you want a layout and redraw of a view and its subviews, and you want it done immediately without waiting for the update cycle. When the call to this method is complete, the layout has already been adjusted and drawn based on all changes that had been noted prior to the method call.

layoutSubviews()

The default implementation which subclasses can override as needed to perform more precise layout of their subviews. You should never call this method directly, but use the above two instead.