What happens when [super loadView] or [super viewDidLoad] is written? I tried to remove the code but the stack overflows and goes into infinite loop. Can someone please explain why is this required?
What happens when [super loadView] or [super viewDidLoad] is written? I tried to remove
Share
First of all, when you override
loadView, to create your own views manually, you should NOT call the superclass’s implementation. This is because you would be creating a view manually, and using those instead of the view that would be created byUIViewController‘s implementation. (See theloadviewdocumentation.)But when you override
viewDidLoad, you should indeed call the superclass’s implementation. This is becauseUIViewController‘s implementation ofviewDidLoaddoes some internal bookkeeping, and so you want to run your customviewDidLoadcode in addition to what the superclass does.