zoukankan      html  css  js  c++  java
  • 在tableView中设置cell的图片和文字

    // 设置UITableViewCellEditingStyle的 accessoryType

      UITableViewCellAccessoryNone,                   // don't show any accessory view

        UITableViewCellAccessoryDisclosureIndicator,    // regular chevron. doesn't track

        UITableViewCellAccessoryDetailDisclosureButton, // info button w/ chevron. tracks

        UITableViewCellAccessoryCheckmark,              // checkmark. doesn't track

        UITableViewCellAccessoryDetailButton

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

    {

        static NSString *ID = @"yxcell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];

        if (cell == nil) {

            cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleSubtitlereuseIdentifier:ID];

            cell.textLabel.backgroundColor = [UIColorclearColor];

            cell.detailTextLabel.backgroundColor = [UIColorclearColor];

            cell.detailTextLabel.font = [UIFontsystemFontOfSize:14];

            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    //        cell.selectionStyle = UITableViewCellSelectionStyleNone;

            

            // cell的背景颜色

            UIView *bg = [[UIView alloc] init];

            bg.backgroundColor = [UIColorbrownColor];

            cell.backgroundView = bg;

            // cell选中的时的背景颜色

            UIView *bgv = [[UIView alloc]init];

            bgv.backgroundColor = [UIColorredColor];

            cell.selectedBackgroundView = bgv;

        }

    //    UIImage *image = [UIImage imageNamed:@"111.jpg"];

    //  cell.imageView.image = image;

        cell.imageView.image = [UIImageimageNamed:@"111.jpg"] ;

        cell.textLabel.text = @"smile集团";

        cell.detailTextLabel.text = @"看清楚了";

        

        return cell;

    }

  • 相关阅读:
    手把手教你整Win10的Linux子系统(Ubuntu)
    Golang从入门到微服务
    GitHub总是打不开
    github无法push?看这篇文章就够了
    shell 操作mysql
    04 elasticsearch学习笔记-基本CRUD
    kibana-6.2.4-amd64的安装
    es 的reindex详解
    ruby 操作csv
    shell 去掉逗号_shell替换和去掉换行符
  • 原文地址:https://www.cnblogs.com/ZGSmile/p/3623113.html
Copyright © 2011-2022 走看看