我試圖在從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.是爲什麼你創建的數據源丟失的全部點。當他們沒有必要的時候,'NSNotification'爲' – user431791
-1'。檢查此鏈接:https://www.andrewcbancroft.com/2015/07/16/uitableview-swipe-to-delete-workflow-in-swift/ – kakubei