What initialization method is called in a subclass of UIViewController when it is nib initialized?

The application delegate has an outlet property for the view controller, and the view controller is created in nib.

Althoug method -viewDidLoad of the view controller is loading, it seems that the initializer assigned to it does not receive the call:

- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle {
    NSLog(@"iniwinib");
    if (self = [super initWithNibName:nibName bundle:nibBundle]) {
        // do stuff
    }
    return self;
}

I also tried with -init, but that also does not get the call. No output from NSLog. Is there any other initializer that I should use in this case?

+3
source share
2 answers

-initWithCoder: ( NIB), , , - -awakeFromNib. , NIB, , .

+9

initWithNibName ViewController - ? , , , , viewController nib. , ViewController nib..

0

Source: https://habr.com/ru/post/1714418/


All Articles