首页 > 编程语言 > 详细

swift tableview 侧滑删除

时间:2017-04-18 14:26:46      阅读:270      评论:0      收藏:0      [点我收藏+]

//返回编辑类型,滑动删除

    func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {

        return UITableViewCellEditingStyle.Delete

    }

    

    //在这里修改删除按钮的文字

    func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {

        return "点击删除"

    }

    

    //点击删除按钮的响应方法,在这里处理删除的逻辑

    func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {

        if editingStyle == UITableViewCellEditingStyle.Delete {

            

                        self.dataList!.removeAtIndex(indexPath.row)

                        self.tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)

        }

    }

swift tableview 侧滑删除

原文:http://www.cnblogs.com/sumx/p/6727216.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!