我尝试覆盖UIViewController子类的默认initWithNibName指定初始化程序,如下所示:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; }
我还在头文件中包含了它的定义.但是,当我的Application Delegate nib加载viewcontroller时,不调用初始化程序,只调用-viewDidLoad.
那个nib magic如何实例化我的视图控制器呢?为什么所有的XCode模板都说明了
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
它是否正确当从另一个nib加载viewcontroller时,我的initWithNibName没有被调用?