NSViewController binding problem

  • Hi, I'm working on refactoring some views into their own nib files,
    and am taking a stab at using NSViewControllers. When I instantiate
    the view controller I set its representedObject to an
    NSArrayController. Something like this:

    viewController = [[SSCustomViewController alloc]
    initWithNibName:@"newView" bundle:nil];
    [viewController setRepresentedObject:arrayController];

    In the new nib file, I set the File's Owner to the
    SSCustomViewController class, then bind values of columns in an
    NSTableView to File's Owner using key paths like
    "representedObject.arrangedObjects.displayText".

    For some reason this seems to be failing - nothing shows up in my
    table view, although I can confirm that the array controller contains
    data.

    However, when I instead set up the bindings in the custom view
    controller's awakeFromNib method, everything seems to work:

    [[myTable tableColumnWithIdentifier:@"displayText"] bind:@"value"
    toObject:[self representedObject] withKeyPath:@"arrangedObjects.
    displayText" options:nil];

    Can anybody offer any clues as to what might be going on here, and why
    setting up bindings in IB isn't working?

    - Dan