UITableViewRowAction
代码:
func tableView(_tableView:UITableView, editActionsForRowAt indexPath:IndexPath) -> [UITableViewRowAction]? {
if indexPath.section==1{
func actionDelegate() ->UITableViewRowAction{
UITableViewRowAction(style: .destructive, title:"删除", handler: { [unownedself] (tableViewAction:UITableViewRowAction, indexPath:IndexPath) ->Void in
//video()
let alert2 =UIAlertController(title:nil, message:"您要删除吗?", preferredStyle: .alert)
alert2.addAction(UIAlertAction(title:"确认",
style: .cancel,
handler:nil))
self.present(alert2, animated:true, completion:nil)
})
}
func addData() ->UITableViewRowAction{
UITableViewRowAction(style: .destructive, title:"添加", handler: { [unownedself] (tableViewAction:UITableViewRowAction, indexPath:IndexPath) ->Voidin
letalert2 =UIAlertController(title:nil, message:"您确定要添加吗?", preferredStyle: .alert)
alert2.addAction(UIAlertAction(title:"确认",
style: .cancel,
handler:nil))
self.present(alert2, animated:true, completion:nil)
})
}
return[actionDelegate(),addData()]
}else{ }
return[]
}
网友评论