![](/img/trans.png)
[英]How can I get iOS to show a delete button on a tableView, but not allow a full swipe from the right to delete
[英]Is there any way to show delete button on Swipe left and Right on tableview call like iOS 6 in iOS 7.
我在向左和向右滑動的UITableView單元上顯示刪除按鈕。
它在iOS 6上運行良好。但是在iOS 7上,您可以向左滾動而不是滑動刪除表視圖單元格,並在最右邊顯示一個刪除按鈕。
有什么辦法可以通過在iOS 7中的iOS 6之類的tableviewcell上左右滑動來顯示刪除按鈕,因為我不希望iOS 7默認刪除行為。
Swift 3試試
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
objects.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.