SwiftKickMobile / TLIndexPathTools

TLIndexPathTools is a small set of classes that can greatly simplify your table and collection views.
tlindexpathtools.com
MIT License
347 stars 60 forks source link

TLCollapsibleTableViewController within Master of a SplitView #37

Closed padams484 closed 9 years ago

padams484 commented 9 years ago

Hi, its a great set of classes, but i am trying to get it to work with custom cells (there are two different types of cells in the Table, with prototyped cells in the storyboard). The following error occurs when the TLCollapsibleTableViewController asks for a prototype cell with Id "cell" (which does not exist).

How can I give it one of my prototype cells?

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* setObjectForKey: object cannot be nil (key: Cell)'

Is there any way to avoid/work arround this?

wtmoose commented 9 years ago

"Cell" is the default cell identifier that TLTableViewController (the parent class of TLCollapsibleTableViewController looks for. There are a few ways to customize this:

  1. Override cellIdentifierAtIndexPath, which is provided to let you provide custom cell IDs.
  2. Or just override cellForRowAtIndexPath and dequeue the cell's yourself. The only thing the default implementation provides is support for view controller-backed cells. If you don't need that, then this may be a good option.
  3. Use the TLIndexPathItem wrapper object for your data model items. This class has a cellIdentifier property that you can set and TLIndexPathTableViewController will see and use that.
wtmoose commented 9 years ago

See the API documentation for TLIndexPathTableViewController http://tlindexpathtools.com/api/Classes/TLTableViewController.html

padams484 commented 9 years ago

Those options look like good solutions, thanks for the quick response.