Re: iOS table views using multiple cell subclasses.
Re: iOS table views using multiple cell subclasses.
- Subject: Re: iOS table views using multiple cell subclasses.
- From: Mike Abdullah <email@hidden>
- Date: Wed, 22 Oct 2014 15:47:36 +0100
On 22 Oct 2014, at 15:19, Alex Zavatone <email@hidden> wrote:
> On my past two gigs, I've spent a fair amount of time subclassing UITableViews and UITableViewCells.
>
> Yesterday another programmer came to me with a question where he wants to plop text of variable lines into a custom footer in his table view.
>
> Sure, that will work, but honestly, this looked Ike a perfect case for another subclass of table view cells, but in another section.
>
> Since time to investigate this approach is non existent, hopefully you guys clarify some preconceptions here.
>
> Since the tableView has a registerNib method, does that imply only one type of custom cell?
>
> If it doesn't, is it conceivable to have cell reuse identifiers for each type of cell subclass? Assuming here we could do something such as "if in section one, display these cells, otherwise display these other cells" or even, "we have data of this type, use this type of cell subclass".
>
> I've become very familiar with the need for cell contentView clearing within the cell's prepareForReuse method with custom cell creation. If registering more than one nib to allow for multiple cell types for a table view's cells is supported, this would great, but I assume that the methods for cellHeightAtIndexPath would have to properly cast the cells based to handle variable cell height as well.
>
> TL;DR: can table views use multiple cell subclasses each with their own XIBs? If so, how?
Yes. Just call -register… multiple times, once for each xib and corresponding identifier.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden