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();
    }
  • 相关阅读:
    中南大学ACM12月月赛第二场热身赛解题报告
    中南大学ACM12月月赛第二场热身赛在本周日(2011年11月20日)举行
    IPv4 and IPv6
    Java and IPV6
    IPv6 and Java
    poj3385
    poj3390
    poj3226
    poj3767
    poj3497
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/4841066.html
Copyright © 2011-2022 走看看