a.方法1:
1 // 1.获取xib中的view, xib中可以同时定义多个view,注意名字不带扩展名
2 NSArray *viewArray = [[NSBundle mainBundle] loadNibNamed:@"app" owner:nil options:nil];
3 UIView *appView = [viewArray lastObject];
b.方法2:
1 UINib *nib = [UINib nibWithNibName:@"app" bundle:[NSBundle mainBundle]];
2 NSArray *viewArray = [nib instantiateWithOwner:nil options:nil];
3 UIView *appView = [viewArray lastObject];
|
|