thedanielhanke
thedanielhanke

Reputation: 738

iOS TabBarController / inits ViewControllers by which init-method?

i currently wonder which init-Method is called in the ViewController via TabBarController on tapping a tab.

i tested

init, initWithStyle, initWithFrame, initWithNibName:andbundle..

but non if them seem to be called.

Any idea, which one is the correct?

for logical reasons i dont want to just use viewDidAppear/Load here..

Any clue?

thanks, Daniel

Upvotes: 1

Views: 499

Answers (1)

Matthias Bauch
Matthias Bauch

Reputation: 90127

it's - (id)initWithCoder:(NSCoder *)aDecoder
But this happens before the tab is tapped. initWithCoder: is called when the viewController is added to the UITabBarController.

If you want to respond to a tap on the tab you have to use viewWillAppear: viewDidAppear: or viewDidLoad

Upvotes: 5

Related Questions