zoukankan      html  css  js  c++  java
  • Swift

    列表单元格尾部可以添加各种样式的附件,如感叹号,三角箭头等。而且点击内容区域与点击附件的这两个响应事件是不同的,这样可以方便我们实现不同的功能(比如点击内容则查看详情,点击感叹号则编辑)
     


    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    //列表项尾部附件点击
    override func tableView(tableView: UITableView,
        accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {
        self.tableView!.deselectRowAtIndexPath(indexPath, animated: true)
        var itemString = self.tasks[indexPath.row]
         
        var alertview = UIAlertView();
        alertview.title = "尾部感叹号点击!"
        alertview.message = "你选中了【(itemString)】";
        alertview.addButtonWithTitle("确定")
        alertview.show();
    }
     
    //列表项内容点击
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        self.tableView!.deselectRowAtIndexPath(indexPath, animated: true)
        var itemString = self.tasks[indexPath.row]
         
        var alertview = UIAlertView();
        alertview.title = "列表项内容点击!"
        alertview.message = "你选中了【(itemString)】";
        alertview.addButtonWithTitle("确定")
        alertview.show();
    }
  • 相关阅读:
    react 样式继承 属性传递
    react css-in-js
    react 利用高阶组件给页面加上动画
    react路由过渡动画效果
    REACT列表过度
    react 过渡动画组件
    VueJs之计算属性
    VueJs之判断与循环
    VusJs之入门
    MYSQL之数据报表
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/4841066.html
Copyright © 2011-2022 走看看