首页 > 其他 > 详细

加载storyboard和xib文件

时间:2015-07-07 11:00:51      阅读:193      评论:0      收藏:0      [点我收藏+]
    // 加载storyboard
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Two" bundle:nil];
    
    // 创建storyboard里面灰色的控制器
   //找到shtoryboard里面设置的初始控制器
// UIViewController *vc = [storyboard instantiateInitialViewController];
  
  // 从storyboard里面找出绑定标识的控制器 MJTwoViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"pink"]; self.window.rootViewController = vc;

2.通过xib加载

 


//nib文件初始化

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; }
//加载所有xib文件
NSArray* objects = [[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil]

//加载指定xib文件
ContactsTableViewCell  *cell = [[[NSBundle mainBundle]loadNibNamed:@"ContactsTableViewCell" owner:nil options:nil] objectAtIndex:0]

 

 

 

加载storyboard和xib文件

原文:http://www.cnblogs.com/luanmage/p/4626209.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!