简体   繁体   中英

Is there any way to show delete button on Swipe left and Right on tableview call like iOS 6 in iOS 7.

I am showing delete button on the UITableView cell on Swipe left and right.

It is working fine on iOS 6. But on iOS 7 instead of swipe delete tableview cell scroll to left and a delete button appears on the right most.

Is there any way to show delete button by Swipe left and Right on tableviewcell like iOS 6 in iOS 7 as I don't want iOS 7 default delete behavior.

Swift 3 Try

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)
    } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM