zoukankan      html  css  js  c++  java
  • iOS-UITableCell详情

    iOS-UITableCell详情

    表示UITableViewCell风格的常量有:

    UITableViewCellStyleDefault

    UITableViewCellStyleSubtitle

    UITableViewCellStyleValue1

    UITableViewCellStyleValue2

    下面是各种式样的图片:
    cell样式


    系统自带cell的代码编写:

    UITableViewCellStyleDefault

        UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.textLabel.text = @"dafasdfa";
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.detailTextLabel.text = @"detaildetaildetaildetaildetail";
        cell.imageView.image = [UIImage imageNamed:@"屏幕快照 2015-05-17 22.01.27"];

    UITableViewCellStyleValue1

        UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
        cell.textLabel.text = @"dafasdfa";
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.detailTextLabel.text = @"detaildetaildetaildetaildetail";
        cell.imageView.image = [UIImage imageNamed:@"屏幕快照 2015-05-17 22.01.27"];

    UITableViewCellStyleValue2

        UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"cell"];
        cell.textLabel.text = @"dafasdfa";
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.detailTextLabel.text = @"detaildetaildetaildetaildetail";

    UITableViewCellStyleSubtitle

        UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
        cell.textLabel.text = @"dafasdfa";
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.detailTextLabel.text = @"detaildetaildetaildetaildetail";
        cell.imageView.image = [UIImage imageNamed:@"屏幕快照 2015-05-17 22.01.27"];

    下面是设置cell的属性介绍

    //cell的右边辅助按钮的样式
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
        //自定义cell右边的辅助按钮
        cell.accessoryView = nil;
        //自定义cell的背景
        cell.backgroundView = nil;
        //设置cell的contentview中的detail的文字内容
        cell.detailTextLabel.text = @"";
        //查看cell当前的编辑模式
        int style = cell.editingStyle;
        //设置当cell进入编辑模式时的辅助按钮样式
        cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
        //自定义cell进入编辑模式后辅助按钮
        cell.editingAccessoryView = nil;
        //获取cell的缩进级别
        int level = cell.indentationLevel;
        //获取cell的缩进宽度
        float width = cell.indentationWidth;
        //设置cell被选中时的背景
        cell.selectedBackgroundView = nil;
        //设置cell的选中状态样式
        cell.selectionStyle = UITableViewCellSelectionStyleBlue;
        //设置cell的contentview中的textlabel文字内容
        cell.textLabel.text = @"";
  • 相关阅读:
    常见的java异常——java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path
    sqlyong到期后怎么办
    解决Jsp与Java后台之间url传值中文乱码问题
    jsp页面获取当前系统时间
    ajax异步发送时遇到的问题
    Shell 基本运算符
    tcp的半连接与完全连接队列(三)源码分析
    tcp的半连接与完全连接队列(二)
    TCP连接的ISN、连接建立超时及TCP的长短连接
    /proc/sys/net/ipv4/下各参数含义
  • 原文地址:https://www.cnblogs.com/AbeDay/p/5026927.html
Copyright © 2011-2022 走看看