ipeActionsConfigurationForRowAt破

ipeActionsConfigurationForRowAt破

本文介绍了ios-TableView TrailingSwipeActionsConfigurationForRowAt破解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IOS11中使用TrailingSwipeActionsConfigurationForRowAt,但是当多次滑动时,应用程序破裂了.

I Use trailingSwipeActionsConfigurationForRowAt in IOS11 but when swipe multiple then app cracked.

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let delete = UIContextualAction(style: .normal, title: "Delete") { action, view, completionHandler in
      print("Deleting!")
      completionHandler(false)
    }
    delete.backgroundColor = UIColor.red
    let config = UISwipeActionsConfiguration(actions: [delete])
    config.performsFirstActionWithFullSwipe = false
    return config
  }

和一些错误

 *** Assertion failure in -[UISwipeActionController swipeHandlerDidBeginSwipe:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3694.4.18/SwipeActions/UISwipeActionController.m:268
 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No occurrence for index path (null)'

推荐答案

我刚刚使用了UIViewController + UITableViewDataSource&UITableViewDelegate组合,而不是使用UITableViewController来解决刷卡问题.

I just used UIViewController + UITableViewDataSource & UITableViewDelegate combination instead of using UITableViewController for the swiping issue.

这篇关于ios-TableView TrailingSwipeActionsConfigurationForRowAt破解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 09:43