iOS5 Storyboard UIViewController which init method is called by the storyboard?

UiviewcontrollerIos5Storyboard

Uiviewcontroller Problem Overview


Which init method is called by the storyboard for UIViewControllers added to the storyboard?

Uiviewcontroller Solutions


Solution 1 - Uiviewcontroller

The initializer used is initWithCoder:

- (id)initWithCoder:(NSCoder *)decoder

Then afterwards you will also get an awakeFromNib message.

Solution 2 - Uiviewcontroller

I believe it is awakeFromNib

Solution 3 - Uiviewcontroller

It is the - (id)initWithCoder:(NSCoder *)decoder

So if you have to do a custom init, let's say using a custom Pager Controller you have to do there like

    - (id)initWithCoder:(NSCoder *)decoder {
        
        self = [super initWithCoder:decoder];
        return [self initWithViewControllers:@[self.playerViewController, self.categoriesViewController]
                  andTitles:@[@"Player",@"Categories"]];
    }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex StoneView Question on Stackoverflow
Solution 1 - UiviewcontrollerFiroze LafeerView Answer on Stackoverflow
Solution 2 - UiviewcontrolleragilityvisionView Answer on Stackoverflow
Solution 3 - UiviewcontrollerloretoparisiView Answer on Stackoverflow