zoukankan      html  css  js  c++  java
  • UITableVIewCell的设置(附标题/高度/右边的标识)

    方法:

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

        //创建cell

        UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];

        //设置cell的图片

        NSString *imageName = [NSString stringWithFormat:@"00%ld.png",indexPath.row + 1];

        cell.imageView.image = [UIImage imageNamed:imageName];

        //设置cell的主标题

        NSString * text = [NSString stringWithFormat:@"产品-%ld",indexPath.row + 1];

        cell.textLabel.text = text;

        //设置cell的附标题, 它的显示跟创建cell时的style有关

       // style = UITableViewCellStyleDefault :附标题不显示,图片显示

       // style = UITableViewCellStyleValue1 :附标题与祝标题平行显示,图片显示

       // style = UITableViewCellStyleValue2 :附标题显示,图片不显示

       // style = UITableViewCellStyleSubtitle :附标题与主标题上下显示,图片显示

        NSString *subtitle = [NSString stringWithFormat:@"产品-%ld很好",indexPath.row + 1];

        

        cell.detailTextLabel.text = subtitle;

        

        //设置右边的图标

        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

        

        return cell;

    }

    // 设置cell的高度继承delegate的方法:不仅要<UITableViewDataSource, UITableViewDelegate>,还要把控制器跟tableview的dataSource连线)

    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

        return 70;

     }

  • 相关阅读:
    ASP.NET 取得 Uri 各项属性值
    js获取当前时间显示在页面上
    脚步提示及跳转
    整体刷新和局部刷新frameset窗口
    asp.net 字符串过滤
    .net 获取当前网页的的url
    优酷去广告最新的关于如何屏蔽优酷广告的方法
    bat命令集合
    修复IE
    网易见外工作台(AI),语音转文字,快速制作字幕,中英翻译,在线修改字幕
  • 原文地址:https://www.cnblogs.com/yuyu-2012/p/4642378.html
Copyright © 2011-2022 走看看