• 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: Need recommendations for best way to build a custom view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need recommendations for best way to build a custom view


  • Subject: Re: Need recommendations for best way to build a custom view
  • From: Ken Tozier <email@hidden>
  • Date: Thu, 19 Feb 2009 20:28:19 -0500

Hmmm. When I add a "nil" column test, the resulting table has the correct number of rows and group rows appear, but it wipes out all the data the cells are supposed to display. By that I mean the table cells are all empty and uneditable. Data only appears in the cells if I remove or comment out the "else if (columnIdentifier == nil)" block.

I noticed this a few weeks ago when I first started using tableView: dataCellForTableColumn: row: but couldn't figure out what was going on. It seems almost like the table renders twice. The first time it ignores your commands and just does whatever it wants and the second time it actually pays attention to the tests.

- (NSCell *) tableView:(NSTableView *) inTableView
dataCellForTableColumn:(NSTableColumn *) inTableColumn
row:(NSInteger) inRow
{
NSString *columnIdentifier = [inTableColumn identifier],
*cellType = [[[testController arrangedObjects] objectAtIndex: inRow] objectForKey: @"cell_type"];

if ([columnIdentifier isEqualToString: @"delete"])
{
NSLog(@"delete table column");
return [cellType isEqualToString: @"project"] ? addCell : deleteCell ;
}
else if ([columnIdentifier isEqualToString: @"page_number"])
{
NSLog(@"page number table column");
return [cellType isEqualToString: @"project"] ? projectNameCell : pageNumberCell ;
}
else if ([columnIdentifier isEqualToString: @"master"])
{
NSLog(@"master table column");
return [cellType isEqualToString: @"project"] ? dummyCell : masterPageCell ;
}
/*else if ((inTableColumn == nil) || (columnIdentifier == nil))
{
// if this block is commented out, the NSLogs in the above 3 blocks print and the cell data displays
// if it is uncommented none of the cell data displays and all that logs to the console is "nil table column." The above 3 logs never print.
NSLog(@"nil table column");
return pageNumberCell;
}*/
else
return [inTableColumn dataCellForRow: inRow];
}



On Feb 19, 2009, at 7:18 PM, Kyle Sluder wrote:

According to the documentation, group rows are treated in delegate
methods as belonging to a nil column.  You seem only to be testing for
actual columns.

Not entirely sure about the editing problem; you're making the cell
not editable, which is appropriate, but perhaps because you're
mistakenly returning the cell in response to a column request it's
using that column's editable property.

--Kyle Sluder

_______________________________________________

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


  • Follow-Ups:
    • Re: Need recommendations for best way to build a custom view
      • From: Kyle Sluder <email@hidden>
References: 
 >Need recommendations for best way to build a custom view (From: Ken Tozier <email@hidden>)
 >Re: Need recommendations for best way to build a custom view (From: Kyle Sluder <email@hidden>)
 >Re: Need recommendations for best way to build a custom view (From: Ken Tozier <email@hidden>)
 >Re: Need recommendations for best way to build a custom view (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Reading from online Byte Array to UITableview best method?
  • Next by Date: Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation
  • Previous by thread: Re: Need recommendations for best way to build a custom view
  • Next by thread: Re: Need recommendations for best way to build a custom view
  • Index(es):
    • Date
    • Thread