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;

    }

  • 相关阅读:
    商业数据分析第七记
    商务数据分析第六记
    商业数据分析第五记
    学英语
    商业数据分析第四记
    商业数据分析第三记
    商业数据分析第二记
    SQL 存储过程笔记
    Java(Android)线程池
    android ImageView 宽度设定,高度自适应
  • 原文地址:https://www.cnblogs.com/ZGSmile/p/3623113.html
Copyright © 2011-2022 走看看