UITableビューから行を削除する前にアラートを表示しようとしています。テーブルビューから削除する前に確認アラートを削除するデータソース
しかし、私はどのようにデータソースに私のビューコントローラのインターフェイスを渡さずにこれを行うことができます。
class BaseTableDataSource: NSObject, UITableViewDataSource {
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
//1. Show alert and delete the block
??? But how can you show the alert with out View controller reference??
//viewcontroller.presentViewController(alertController, animated: true, completion: nil)
}
}
}
1.醜いものを使用したくない場合は、データソースをまったく使用しないでください。 2.データソースを作成した理由のすべてが失われています。 – user431791
-1が必要でないときは、 'NSNotification'に対して-1を返します。このリンクをチェックしてください:https://www.andrewcbancroft.com/2015/07/16/uitableview-swipe-to-delete-workflow-in-swift/ – kakubei