加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Swift-UITableViewCell:设置表格的accessoryType属性

发布时间:2020-12-14 01:31:49 所属栏目:百科 来源:网络整理
导读:UPDATE 2015/12/24: Updated for Xcode 7.2 and Swift 2 UITableViewCell的---accessoryType属性 设置accessoryType属性//没有任何样式cell.accessoryType = UITableViewCellAccessoryType.None//一个小箭头(这是APP上常见的形式)cell.accessoryType = UITab

> UPDATE 2015/12/24: Updated for Xcode 7.2 and Swift 2

UITableViewCell的---accessoryType属性

设置accessoryType属性

//没有任何样式
cell.accessoryType = UITableViewCellAccessoryType.None

//一个小箭头(这是APP上常见的形式)
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator

//一个Info图标
cell.accessoryType = UITableViewCellAccessoryType.DetailButton



//一个Info图标+一个小箭头
cell.accessoryType = UITableViewCellAccessoryType.DetailDisclosureButton;

//一个对勾
cell.accessoryType = UITableViewCellAccessoryType.Checkmark

代码示例:

func tableView(tableView: UITableView,cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let cell:UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle,reuseIdentifier:"mycell");
        
        
        cell.textLabel!.text = dataScoureArr[indexPath.row]
        cell.textLabel?.backgroundColor = UIColor.lightGrayColor()
        cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
        return cell

    }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读