即使我丢弃了一个滑动动作的图标,最后堆叠的动作也总是超出屏幕范围。 这是我的代码:
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let leavedetails = UIContextualAction(style: .normal, title: "LEAVE") { (action, view, nil) in
print("leave details")
self.setView(view: self.floatView)
}
leavedetails.image = UIImage(named: "leavedetails")
leavedetails.backgroundColor = UIColor.blue
let approved = UIContextualAction(style: .normal, title: "APPROVE") { (action, view, nil) in
print("approved")
}
approved.image = UIImage(named: "accept")
approved.backgroundColor = UIColor.green
let reject = UIContextualAction(style: .destructive, title: "REJECT") { (action, view, nil) in
print("reject")
}
reject.image = UIImage(named: "reject")
reject.backgroundColor = UIColor.red
let config = UISwipeActionsConfiguration(actions: [approved, leavedetails])
config.performsFirstActionWithFullSwipe = false
return config
}