UIViewController的-init方法和- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil的关系

HomePageViewController *homePageViewController = [[HomePageViewController alloc] init];

视图控制器对象的-init方法的内部会自动调用-initWithNibName: bundle:方法

  • (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

      [self requestContentForHomePageAtIndex:0];
    

    }

    return self;
    }

你可能感兴趣的:(UIViewController的-init方法和- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil的关系)