1.从xib加载ViewController
(1)调用CustomerVC *vc =[[CustomerVC alloc] initWithNibName:@"CustomerVC" bundle:[NSBundle mainBundle]];
会调用-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
(2)CustomerVC *vc = [[CustomerVC alloc] init];
会先调用-(instancetype)init然后调用-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
2.从xib加载View
(1).CustomView *myView = [[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:nil options:nil].lastObject;
不会调用init,和initwithframe方法
(2).CustomView *myView = [[CustomView alloc] init];
先调用init方法->再调用initwithframe方法
(3).如果在xib中嵌入了CustomView视图,会调用initwithcoder->再调用awakefromnib方法