Swift / Enable Editing Mode in View Controller

后端 未结 1 2010
南笙
南笙 2021-02-04 16:38

Because of UI elements, I created View Controller with a TableView inside. But I can\'t enable editing mode. I tried several methods without Solution. But with using TableView C

相关标签:
1条回答
  • 2021-02-04 17:03

    You forgot to put the table view in editing mode:

    override func setEditing(editing: Bool, animated: Bool) {
        super.setEditing(editing, animated: animated)
        self.tableView.setEditing(editing, animated: animated)
    }
    

    I'm assuming you have a tableView property. Adjust as needed.

    Some other things you may want to do to emulate a UITableViewController:

    1. In viewWillAppear you should deselect the currently selected row in the table view.
    2. In viewDidAppear you should flash the scrollbars of the table view.
    0 讨论(0)
提交回复
热议问题