When view is loaded manually, developer remains in control when it comes to initializations, we choose what initializer to call, what variables to set etc.
When view is loaded from the storyboard segue … what happens to that initializer? Where should variables be set i’d like to be available once view had been loaded?
Please help me understand the sequence here. How is instance of the class created here, who creates it and how can we intervene and help set it up to our liking?
When a view is loaded from a nib or storyboard, it’s
-initWithCoder:method is called. Like-initWithFrame:,-initWithCoder:is a designated initializer for UIView. If you’re going to do any custom initialization for a UIView subclass, you should make sure that it happens for both these methods. One common technique is to add a common initialization method that you call from both-initWithFrame:and-initWithCoder:. See my answer to Custom view and implementing init method? for a more detailed description.Note that the documentation for
-initWithFrame:explains: