• 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
Very basic table binding blind spot
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Very basic table binding blind spot


  • Subject: Very basic table binding blind spot
  • From: Erik Stainsby <email@hidden>
  • Date: Thu, 02 Aug 2012 22:16:20 -0700


I do so wish there was a Complete Idiot's Guide to Cocoa Table Bindings … The very flexibility which I know must be their great virtue tends to obscure the clear path from my sight more often than not.  Forest, trees, trees, forest … Oh! Something shiny!
---

So tonight I have an NSArrayController (RSTableArrayController) which I have populated with dictionary objects of the form:

[self.content addObject:[NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects: key, [mvo valueForKey:key],nil] forKeys:[NSArray arrayWithObjects:@"label",@"value",nil]]];



For this simple two column data I have a two column table, using Table View Cells (I'm going to have visual objects in place of the 'label' later on).
I have set the identifier for the tableView columns very imaginatively to "label", and "value".
The array controller is also < NSTableViewDataSource, NSTableViewDelegate >. I have implemented the following two delegate methods:

- (NSInteger)	numberOfRowsInTableView:(NSTableView *)aTableView {
	return self.content.count;
}

- (id)			tableView:(NSTableView *)aTableView	objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex {
	NSString * identifier = [tableColumn identifier];
	NSDictionary * dict = [self.content objectAtIndex:rowIndex];
	NSLog(@"%s- [d] %@: %@", __PRETTY_FUNCTION__, __LINE__, identifier,[dict valueForKey:identifier]);
	return [dict valueForKey:identifier];
}

In the nib, I have an ArrayController object of the class described above RSTableArrayController. It is wired up as the delegate and dataSource for the tableView.


And here is where I get lost time and again, tracing the appropriate path to the content and it's constituent data parts and binding them to the appropriate element in the tableView.

» Scroll View
	» Table View
		» Table Column
			» Table Cell View
				» Static Text
					 Text Field Cell

Given that the delegate method is called  -[tableView: objectValueForTableColumn: row:]  I should expect to bind the arrayController's objectValue in the Bindings Inspector to the ?node?  in the object browser.  Do I need to do more than get that right?

~ Erik,
currently batting .034 in the bindings league ...


_______________________________________________

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: Very basic table binding blind spot
      • From: Kyle Sluder <email@hidden>
    • Re: Very basic table binding blind spot
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Mountain Lion problems with orderFrontColorPanel:
  • Next by Date: Re: Very basic table binding blind spot
  • Previous by thread: Any way to get live updates when dragging an annotation?
  • Next by thread: Re: Very basic table binding blind spot
  • Index(es):
    • Date
    • Thread