如何在编辑模式下的UITableView中选择多行? [英] How to select multiple rows in UITableView in edit mode?

查看:112
本文介绍了如何在编辑模式下的UITableView中选择多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问的是,如何前进到编辑模式,如在消息"应用程序中一样,当您单击右上角的选择"按钮时,可以选择多个行,可以通过点按圆圈来选择多个消息

I want to ask, how can I forward to edit mode, where I can to select multiple rows, as in Messages app, when you click on top right button "Select", when you can choose multiple messages by tapping on circles.

赞:

我确实搜索了很多,但找不到任何东西.谁能帮我?一些建议

I searched a lot, really, but couldn't find anything. Can anyone help me? Some advices

推荐答案

设置

tableView.allowsMultipleSelectionDuringEditing = true

屏幕截图

演示代码

class TableviewController:UITableViewController{
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.allowsMultipleSelectionDuringEditing = true
        tableView.setEditing(true, animated: false)
    }
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
        cell.textLabel?.text = "\(indexPath.row)"
        return cell
    }
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
}

这篇关于如何在编辑模式下的UITableView中选择多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆