zoukankan      html  css  js  c++  java
  • iOS中读取Cell的两种方式(资源包种加载Cell,从nib文件中注册cell)和xib知识点

    第一种从资源包中加载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];
    //    
    
    
  • 相关阅读:
    laravel
    composer lavarel 安装
    phpstudy 500 Internal Server Error 解决办法
    阿里云php-7.2.12 安装
    mysql索引
    服务器配置-双机热备
    layui动态数据表格-分页
    layui 笔记
    Thinkphp5.1 模板路径报错
    window/linux composer安装/卸载
  • 原文地址:https://www.cnblogs.com/wohaoxue/p/4805682.html
Copyright © 2011-2022 走看看