• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iOS table views using multiple cell subclasses.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >iOS table views using multiple cell subclasses. (From: Alex Zavatone <email@hidden>)

  • Prev by Date: iOS table views using multiple cell subclasses.
  • Next by Date: Re: NSInvocation crashes in AutoreleasePool
  • Previous by thread: iOS table views using multiple cell subclasses.
  • Next by thread: Crash with ARC enabled on Xcode 6.1
  • Index(es):
    • Date
    • Thread