码迷,mamicode.com
首页 > 编程语言 > 详细

Swift - 列表项尾部附件点击响应(感叹号,箭头等)

时间:2015-09-26 18:37:33      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:

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

技术分享

 

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();
}

Swift - 列表项尾部附件点击响应(感叹号,箭头等)

标签:

原文地址:http://www.cnblogs.com/Free-Thinker/p/4841066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!