首页 > 移动平台 > 详细

ios8 新特性 UITableViewRowAction

时间:2015-09-21 15:42:26      阅读:378      评论:0      收藏:0      [点我收藏+]

// 原滑动删除方法,需保留
    override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
        
    }
    
    // 滑动删除与编辑
    override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
        
        var editAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "编辑") {
            (action: UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
            
           // 编辑的业务逻辑


        }
        
        var deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Normal, title: "删除") {
            (action: UITableViewRowAction!,indexPath: NSIndexPath!) -> Void in
            
           // 删除的业务逻辑


        }
        
        // 设置背景颜色
        editAction.backgroundColor = UIColor.lightGrayColor()
        deleteAction.backgroundColor = UIColor.redColor()
        return [deleteAction, editAction]
    }

 

技术分享

 

ios8 新特性 UITableViewRowAction

原文:http://www.cnblogs.com/lisen-lisen/p/4826142.html

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