Friday 15 February 2013

iphone - How to create subclass of UITableViewController to extend capabilities? -


Creating Functionality in UtitViewController When a user taps a certain cell, then a new cell slides down from the tape with an input sequence (i.e., a picker view, etc.).

Now I can make this behavior more on every table view controller, but I am thinking that instead of there, there was a way that I could create a sub-section of Table View Controller Makes automatic interpretation. My idea is to create a new Protocol-Representative Method that tells the representative to return an input view for a given index path, then my subclass is automatically inserted into a cell below the tap cell Will know for

The idea behind such an implementation is that table view is created using the same data source, and the only difference of representative methods in the form of a table view is that if the new representative method is any Returns an input view for the given index path, so I'll know that to provide that functionality to the tape cell

So my question is that when a cell is taped by subclassing UITableViewController, how do I get to implement this automatic cell insertion (insert input view)?

I am quite familiar with the ideas of the iOS table, I do not understand how I can expand the abilities by creating a sub-class. Any help would be greatly appreciated.

sorry in advance if this answer runs on stuff then you are already familiar with - I was not sure what would be a good starting point.

So when we talk about tables on iOS then we have three components - UITableView itself, representative , and To help us with the data source (I'm sure you already know it), Apple offers a UIViewController subclass that provides a table view, representative, and data source Manages - UITableViewController .

You are clearly correct to think that instead of duplicating all the UITableViewController examples used in your code, instead of duplicating your 'automatic input cell entry' 'Logic is more clear, clean and better.

However , and this is the key thing, representatives and data sources methods not part of UITableViewController - They are a part of UITableView . It seems that what you really want to do is subclass table view and extended delegate / data source methods.

If that is misleading, think about it like this: Ideally you want your improvement to be done, inserting the automatic input cell, anywhere to work For table view - Table views can be used in any view controller (or view), not just in the table view controller, and representative methods are not not implemented in the controller only is.

If you want to subclass UITableView , then modify your new input view methods () to delegate and data sources, and then - if you want - Create a UITableViewController sub-category that uses your table view sub-class by default.

No comments:

Post a Comment