美文网首页Swift基础入坑
table进阶--单元格交互

table进阶--单元格交互

作者: iOS_July | 来源:发表于2018-06-11 10:39 被阅读9次

delegate:页眉页脚、单元格交互、排序等

闭包:没有名字的函数,一般用于嵌入其他函数之中

值得一提的是cell右部的扩展
public enum UITableViewCellAccessoryType : Int {

    
    case none // don't show any accessory view

    case disclosureIndicator // regular chevron. doesn't track 灰色右键

    case detailDisclosureButton // info button w/ chevron. tracks 蓝色加圈 详情感叹号

    case checkmark // checkmark. doesn't track   蓝色小勾

    @available(iOS 7.0, *)
    case detailButton // info button. tracks  蓝色加圈 详情感叹号
}

点击cell

 override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 80
    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        
        let alertAC = UIAlertController(title: "友情提示", message: "您点击了\n第\(indexPath.row)行的\n ->\(parts[indexPath.row])<-", preferredStyle: .actionSheet)
        
        let action = UIAlertAction(title: "我去过", style: .default) { (_) in
            let cell = tableView.cellForRow(at: indexPath)
            
            //右部扩展
            cell?.accessoryType = .checkmark
            
        }
        let action2 = UIAlertAction(title: "不明白", style: .cancel, handler: nil)
        let action3 = UIAlertAction(title: "我是红色哟", style: .destructive, handler: nil)
        
        alertAC.addAction(action)
        alertAC.addAction(action2)
        alertAC.addAction(action3)
        
        self.present(alertAC, animated: true, completion: nil)
    }

相关文章

  • table进阶--单元格交互

    delegate:页眉页脚、单元格交互、排序等 闭包:没有名字的函数,一般用于嵌入其他函数之中 值得一提的是cel...

  • [前端学习]html部分学习笔记,第二天

  • 标签(二)

    1.表格 table:表格 tr:table row,行 td: table dock,单元格 嵌套关系为tabl...

  • 2020-10-19

    table 表格 合并单元格 input 表单提交

  • html的table标签

    html表格:table cellspacing单元格外边距cellpadding单元格内边距 colspan=2...

  • 2018-06-13 学习笔记1

    表格 用 table 表示, 行数 用 tr 表示, 单元格 用 td 表示, td:table data。表示...

  • ReactTable的说明

    table样式 属性说明 普通table 翻页 排序 进阶table table的某些列是需要自定义样式,有些时候...

  • html中table

    table的一些属性cellspacing单元格外边距 cellpadding单元格内边距 colspan=2,横...

  • Matplotlib绘制表格

    table函数只有美化标题的方法,美化单元格参考https://matplotlib.org/api/table_...

  • HTML 相关知识

    1.table布局 cellpadding:单元格与内容的填充距离cellspacing:单元格之间的距离cols...

网友评论

    本文标题:table进阶--单元格交互

    本文链接:https://www.haomeiwen.com/subject/hhcrsftx.html