• 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: View Based Table - where is my data?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: View Based Table - where is my data?


  • Subject: Re: View Based Table - where is my data?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 02 May 2013 00:27:49 +0700

On 1 May 2013, at 23:51, Quincey Morris <email@hidden> wrote:

> On May 1, 2013, at 08:34 , "Gerriet M. Denkmann" <email@hidden> wrote:
>
>> - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
>> {
>> 	NSDictionary *aLine = self.dataArray[rowIndex];
>> 	NSTableCellView *cellView = [ aTableView makeViewWithIdentifier: @"DieSpalte" owner: self ];
>> 	[ cellView.textField setStringValue: aLine[kNameKey] ];
>> 	[ cellView.imageView setImage: aLine[kImageKey] ];
>> 	NSLog(@"%s %ld %@",__FUNCTION__, rowIndex, cellView);
>> 	return cellView;
>> }
>
> This is wrong. You should not create a cell view in this method, and you should not return a cell view as a result. The value returned from this method becomes the the "objectValue"  property of the cell view. Because you're trying to create the cell view in the wrong place, the table view is creating one for you (a different one), and that view isn't getting its text or image set to anything useful.
>
> Instead, you should be putting the above code in a 'tableView:viewForTableColumn:row:' delegate method. Since you're (apparently) not using any bindings within your cell view, you don't need objectValue at all -- neither the data source method nor the property.

You are absolutely right.
And I was confused, because before I implemented my data-source method numberOfRowsInTableView: I was told: " *** Illegal NSTableView data source (<TbViAppDelegate: 0x101a22760>).  Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:" which seems not really true after all.

Thanks a lot!


Kind regards,

Gerriet.
_______________________________________________

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: 
 >View Based Table - where is my data? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: View Based Table - where is my data? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: View Based Table - where is my data?
  • Next by Date: Built-in Activity Types
  • Previous by thread: Re: View Based Table - where is my data?
  • Next by thread: Built-in Activity Types
  • Index(es):
    • Date
    • Thread