标签:action path round col and 分享 can func dex
// 响应单元格右滑手势 override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let actionShare = UITableViewRowAction(style: .normal, title: "分享") { (_,IndexPath) in // 定义滑动菜单样式和标题 let actionSheet = UIAlertController(title: "分享到", message: nil, preferredStyle: .actionSheet) // 定义按钮 let optionQQ = UIAlertAction(title: "QQ", style: .default, handler: nil) let optionWeiXin = UIAlertAction(title: "微信", style: .default, handler: nil) let optionCancel = UIAlertAction(title: "取消", style: .cancel, handler: nil) // 把option操作添加到actionSheet中 actionSheet.addAction(optionQQ) actionSheet.addAction(optionWeiXin) actionSheet.addAction(optionCancel) // 显示 self.present(actionSheet, animated: true, completion: nil) } // 配置按钮颜色 actionShare.backgroundColor = UIColor.orange let actionDel = UITableViewRowAction(style: .destructive, title: "删除") { (_, IndexPath) in // 删除相对应的每行数据 self.areaImages.remove(at: indexPath.row) self.areaProvice.remove(at: indexPath.row) self.areas.remove(at: indexPath.row) self.areaType.remove(at: indexPath.row) self.visted.remove(at: indexPath.row) // Delete the row from the data source tableView.deleteRows(at: [indexPath], with: .fade) } let actionTop = UITableViewRowAction(style: .default, title: "置顶") { (_, _) in } actionTop.backgroundColor=UIColor(red: 245/255, green: 199/255, blue: 221/255, alpha: 1) // 返回滑动子菜单数组 return [actionShare,actionDel,actionTop] }
标签:action path round col and 分享 can func dex
原文地址:http://www.cnblogs.com/lizhipengvvip/p/7499658.html