Unable to delete rows in table using Three20

老子叫甜甜 提交于 2019-12-06 01:05:52

Your experience with TTTableViewController is also going to be a little different than you might expect because it does not inherit from UITableViewController. Unlike most iPhone tutorials that have the table's view controller also implement the UITableViewDelegate and UITableViewDataSource protocols, Three20 implements them through separate classes: you are expected to set the controller's dataSource property with a model instance, and the controller creates its own delegate (in the createDelegate method, which you can override).

The method you want to implement, tableView:commitEditingStyle:forRowAtIndexPath:, is part of the UITableViewDataSource protocol, so you're going to need to implement that on your model class, and not on the controller itself.

The TTTableViewController does not directly do anything with setEditing:animated:, and just inherits the base implementation from UIViewController.

The model:didDeleteObject: method that you see is inherited from TTModelViewController as an implementation of the TTModelDelegate protocol. It's there so that changes to the underlying data model can notify the view layer of changes. For instance, if your application is downloading data from the web, rows may appear and disappear all the time, independent of what's going on with the user interface. If you're trying to drive edits through the UI, you shouldn't need to mess with that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!