Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can viewDidLoad get called before 'init' of a viewController is fully executed?

What is the full sequence events in terms of how a view controller loaded into memory from init to viewDidLoad?

If you do something like:

TabControllerClass *cc = [[TabControllerClass alloc] initWithCustomData:something];

Can the class's viewDidLoad get invoked before reaching the end of the custom init method, 'initWithCustomData'?

- (id)initWithCustomData:(NSString *)something
{
    if (self = [super init])
    {
        // A bunch of other initialization happens
    }

    // Would you reach here before 'viewDidLoad' is invoked?
    return self;
}

where my TabControllerClass inherits from UITabBarController.

like image 687
Jonas Anderson Avatar asked Oct 25 '22 17:10

Jonas Anderson


1 Answers

I assume not. I mean, how can any method be called before the controller is correctly allocated and initialized? However, you may find that your -[ControllerClass initWithCustomData] initializer isn't the designated initializer, which could explain why it isn't being called.

like image 58
Alexsander Akers Avatar answered Oct 31 '22 08:10

Alexsander Akers