不疯不成魔

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

第一种从资源包中加载cell

static NSString *identifier = @"resuse";
    EditCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if(!cell){
        cell = [[[NSBundle mainBundle] loadNibNamed:@"EditCell" owner:nil options:nil] lastObject];
    }
    
    
    
    NSLog(@"--------%@",cell);
    
    return cell;

第二从从nib文件中注册cell

   [self.tableView registerNib:[UINib nibWithNibName:@"EditCell" bundle:nil] forCellReuseIdentifier:@"resuse"];

 

 

//xib知识点

//如果直接使用init初始化方法,这调用指定初始化方法,initWithNibName:bundle:时,nibName和bundle都为空,如果为空,则默认查找与类名相同的XIB文件
    //NSBundle -- 应用程序的包(存储应用程序加载的所有的资源)
//    FirstViewController *rootVC = [[FirstViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];//Bundle 默认的是 [NSBundle mainBundle] 此时给nil 会自动选择默认值
//    self.window.rootViewController = rootVC;
//    [rootVC release];
//    

 

posted on 2015-09-13 21:45  不疯不成魔  阅读(414)  评论(0编辑  收藏  举报