【发布时间】:2015-06-06 22:28:36
【问题描述】:
因为 UI 元素,我创建了 View Controller 里面有一个 TableView。 但我无法启用编辑模式。我尝试了几种没有解决方案的方法。 但是使用 TableView Controller 没有问题。
我尝试了什么:
override func viewDidLoad() {
self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func setEditing(editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if (editingStyle == UITableViewCellEditingStyle.Delete) {
// Action to delete data
}
}
问题可能出在哪里?
【问题讨论】:
-
但这是针对 tableview Controller 而不是 viewcontroller
标签: ios swift uitableview uiviewcontroller edit