zoukankan      html  css  js  c++  java
  • UITableView控件Protocell的Identifier设置 注意事项

    1.  注意:如果想使用Subtitle类型的单元格,需在Storyboard中将Protocell设置为subtitle类型,且Protocellidentifier必须与ViewController中cellForRow方法设置,保持一致,才能保证在subtitle行内容被显示出来。

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

     

        static NSString *ID = @"video"; //====注意错误:需在Storyboard中将Protocell设置为subtitle类型,并将此处ID"video"写在Protocellidentifier后面,才能保证在subtitle行显示视频的时长=========//

        

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID forIndexPath:indexPath];

        

        if (cell == nil) {

            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];

        }

        

        WZVideo *video = self.videosM[indexPath.row];

        cell.textLabel.text = video.name;

        cell.detailTextLabel.text = [NSString stringWithFormat:@"时长:%d 分钟",video.length];

        

        return cell;

    }

    2. YellowGuys应用截图:

    iOS开发者交流群:180080550
  • 相关阅读:
    68
    56
    Django manager 命令笔记
    Django 执行 manage 命令方式
    Django 连接 Mysql (8.0.16) 失败
    Python django 安装 mysqlclient 失败
    H.264 SODB RBSP EBSP的区别
    FFmpeg—— Bitstream Filters 作用
    MySQL 远程连接问题 (Windows Server)
    MySQL 笔记
  • 原文地址:https://www.cnblogs.com/stevenwuzheng/p/5196613.html
Copyright © 2011-2022 走看看