错误:不允许在取消分配时尝试加载视图控制器的视图,并且可能导致未定义的行为()
有什么想法?我想我在一个视图中呈现了太多的控制器,但我无法弄清楚我应该做些什么。
我们将不胜感激。感谢。
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if (editingStyle == UITableViewCellEditingStyle.Delete) {
// handle delete (by removing the data from your array and updating the tableview)
let alert:UIAlertController = UIAlertController(title: "Confirmation", message: "Delete this message?", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default, handler: {
(action) -> Void in
// action
// delete this notification
// after delete in server, will refresh table view
refreshResults()
}))
alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Default, handler: {
(action) -> Void in
}))
}
}