• 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: Design for custom tableviewcell button action
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Design for custom tableviewcell button action


  • Subject: Re: Design for custom tableviewcell button action
  • From: mmalc Crawford <email@hidden>
  • Date: Fri, 03 Jul 2009 14:55:51 -0700


On Jul 3, 2009, at 2:45 PM, Brian Slick wrote:

So now I either need to figure out how to make my scenarios all work with a single identifier, or I may just go ahead with the code-only cell I just built in response to the performance issue. If would be nice if there was some kind of queueWithReuseIdentifier: method for these XIB cases.

Oh, you can have as many identifiers as you want.
For a nib-based approach, simply have as many nib files as you want -- where each nib file has a single cell but a different identifier -- and you probably(*) have an outlet for each type.



// Caveat: Typed in Mail
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


	if (condition1) {
		static NSString *CellType1Identifier = @"CellType1Identifier";

CellType1 *cell = (CellType1 *)[tableView dequeueReusableCellWithIdentifier:CellType1Identifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CellType1" owner:self options:nil];
cell = cellType1;
self. cellType1 = nil;
// configure cell ...
return cell;
}


	if (condition2) {
		static NSString *CellType12dentifier = @"CellType12dentifier";

CellType1 *cell = (CellType1 *)[tableView dequeueReusableCellWithIdentifier:CellType2Identifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CellType2" owner:self options:nil];
cell = cellType2;
self. cellType2 = nil;
// configure cell ...
return cell;
}


	// ...


(*) You wouldn't actually *need* a different outlet for each type, since the outlet is used only very briefly for each load, and each load happens sequentially, but you may prefer to identify each type nevertheless.



Incidentally, that's what is wrong with TaggedLocations... it also does not have the identifier in the XIB. I manually added it, then retested, and saw dramatically better performance (for my own program, too).
[...]
All this aside, please file a performance bug against the TaggedLocations sample.
Done, although I'm not sure if I did so correctly. Thank you for your help.


Ah, thanks. If you could send the bug number, that would be useful.

mmalc

_______________________________________________

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: 
 >Re: Design for custom tableviewcell button action (From: Brian Slick <email@hidden>)
 >Re: Design for custom tableviewcell button action (From: mmalc Crawford <email@hidden>)
 >Re: Design for custom tableviewcell button action (From: Brian Slick <email@hidden>)

  • Prev by Date: Re: in search of a starter iphone painting tutorial or sample code
  • Next by Date: Re: in search of a starter iphone painting tutorial or sample code
  • Previous by thread: Re: Design for custom tableviewcell button action
  • Next by thread: Securely limit the running an application by serial number
  • Index(es):
    • Date
    • Thread