On Jul 17, 2008, at 8:53 AM, Ivy Feraco <[EMAIL PROTECTED]> wrote:
There was a previous post back in April about a problem with binding
to the representedObject in NSViewController.
When instantiating the view controller, I set the represented object
to an NSArrayController.
vc = [[MyViewController alloc] initWithNibName:@"newView" bundle:nil];
[vc setRepresentedObject:arrayController];
When setting the bindings in the nib file, I make the File's Owner
MyViewController class, then try to bind columns of NSTableView to
the File's Owner using a path like
representedObject.arrangedObjects.displayText.
The tableview is expecting to be bound to the arraycontroller
directly. It doesn't know that representedObject is an arrayController.
Either put the arrayController as a top level object in the nib or
create the binding in awakeFromNib using the arrayController as the
"toObject:" argument and @"arrangedObjects.columnPropertyName" as the
keypath.
This would not work, even though the array controller does contain
data.
A previous post brought up the exact same issue, and he worked
around it by using the awakefromNib method to bind the table to the
representedObject's arrangedObjects in code. I did something similar
using the windowDidLoad method.
So I want to reopen the issue - Does anyone have any insight into
why it doesn't work in IB?
It seems like it should, and that this was an intended benefit of
having a representedObject for the ViewController, and Apple's
NSVIewController documentation seems to confirm this:
"Declaring a generic representedObject property, to make it easy to
establish bindings in the nib to an object that isn't yet known at
nib-loading time or readily available to the code that's doing the
nib loading."
.... so, is it a Cocoa bug?
Thanks,
Ivy Feraco
UI Developer
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/luesang%40apple.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]