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;

    }

  • 相关阅读:
    MyEclipse10 复制之前的项目部署到tomcat时项目名称对不上,还是复制前的项目名称,哪里修改设置
    11 The superlative
    jQuery Mobile学习笔记
    MySQL基础
    ANGULAR $HTTP请求
    Effective前端5:减少前端代码耦合
    AJAX的简介
    原生ajax
    Ionic实战 自动升级APP(Android版)
    读取数据库信息构建视图字段的备注信息,方便程序代码生成
  • 原文地址:https://www.cnblogs.com/ZGSmile/p/3623113.html
Copyright © 2011-2022 走看看