You will want to create a subclass whenever you need a custom layout, there is no way to delegate it. This is also the only reasonable way to do this: if you contain a set of views in the supervisor, this view should control its layout routine for ease of maintenance.
You also don’t need to do the layout of the view in layoutSubviews - you can just create a layout when creating a supervisor and assign positions and sizes at this point if you do not need something reusable.
source
share