一句话小计:initWithNibName

来源:互联网 发布:淘宝欧时力有正品吗 编辑:程序博客网 时间:2024/06/15 15:49
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle{/*self = [super initWithNibName:nilbundle:nil];*/// Get a pointer to the application bundle objectNSBundle *appBundle = [NSBundle mainBundle];self = [super initWithNibName:@"xxx"bundle:appBundle];if (self) {...}return self;}
以前一直不能理解 initWithNibName的参数是什么意思,这下理解了:
第一个参数 initWithNibName:xib文件的名称,如果传入nil,在系统自动会去找名称一样的xib文件
第二个参数  bundle:程序应该在哪个bundle目录下来找xib文件,传入nil,则会在app应用目录下找xib文件
0 0