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
  • 相关阅读:
    ICS SIP Call移植
    ubuntu常用软件安装
    ubuntu开机自动设置屏幕亮度
    书摘《苹果是方的》
    dbml 添加时自动生成 Guid & DataTime
    English 中有趣的a和d
    asp.net 生成ul控件
    lambda c# 3.0
    0809 END Lakers
    linq c# 3.0
  • 原文地址:https://www.cnblogs.com/stevenwuzheng/p/5196613.html
Copyright © 2011-2022 走看看