Keary. Tahnks a lot for the info,
I will spend more time them trying to solve this bindings problems,,, I see my problem is not just bindings, but some Obj-c related stuff, like references outlets between classes, I did something similar a while back (puting IBOutlets for other controllers ), and it worked very good, I ill take a look at the source again and see. Also then I think Im not placing the Object inside IB, So I guess inside UserListView.xib, I will put an NSObject isntance, and conect it to the InvoiceEditionViewController IBOutlet, then I guess it should reference the same controller, hence the same NSArrayController. Ok I will orginize my ideas better. Thanks a lot. Gustavo On Tue, Oct 13, 2009 at 1:41 AM, Keary Suska <[email protected]> wrote: > On Oct 12, 2009, at 1:33 PM, Gustavo Pizano wrote: > >> Keary Hello: >> >>> >>> This doesn't appear sensible, and you may have a number of problems. >>> First, make sure that InvoiceEditionViewController is being instantiated >> >> this is what Im doing: in the awakeFromNib >> >> if(_userListController == nil){ >> _userListController = [[UserListViewController alloc] >> initWithNibName:@"UserListView" bundle:nil]; >> } >> if(_invoiceController == nil){ >> _invoiceController = [[InvoiceEditionViewController alloc] >> initWithNibName:@"InvoiceEditionView" bundle:nil]; >> } >> [_myUserListView addSubview:[_userListController view]]; >> [_myContentView addSubview:[_invoiceController view]]; >> [_invoiceController setUserController:_userListController]; > > You mentioned having an outlet from the UserListViewController to the > InvoiceEditionViewController--this can only be accomplished in the > InvoiceEditionViewController is in the UserListViewController's nib, in > which case you are instantiating two different InvoiceEditionViewControllers > and hence experiencing problems. > > If the InvoiceEditionViewController is *not* in the UserListViewController > nib, the above should work fine, except still consider the > NSObjectController but with the correct key path. > >>> properly. Second, simply have a reference to UserListViewController in >>> InvoiceEditionViewController, which can be an outlet if >> >> ok done I have now there this : IBOutlet UserListViewController * >> userController; > > This is only useful if the InvoiceEditionViewController is instantiated in > the UserListViewController nib, If it is, then chances are that the > InvoiceEditionViewController is not being instantiated correctly unless you > have overridden -init or -initWithCoder:, depending on the super class. > >>> InvoiceEditionViewController can be sensibly instantiated via xib, or set >>> by other means. I recommend then to have an NSObjectController in >>> InvoiceEditionViewController.xib whose content is bound to >>> UserListViewController.NSArrayController.selection (using correct >>> ivar/property names, of course). >> >> Ok I tried but when wan tto bind the labels to show the details I bind it >> to the NSObjectControlled I just configured, and the controller key goes to >> selection, which its not good, so whe I run I see its NO Selection. label. > > No, "selection" is the correct controller key for data access. It is > confusing for an object controller as there will only be one selection (or > none), but that is how it works. > >> I did instead was to place an NSArrayController (users) in IB and bind the >> contents to userController._userListArrayController.arrangedObjects. >> then the labels I bind the values to users, and the controller key to >> selection and the path to the attributes of the entity. > >> And it works 50%, I can see the values., but when I select another user, >> the values dosn't change, it's seems its getting only the 1st value of the >> array. > > Of course. You are creating a whole different array controller that has its > own selection semantics. Bindings are automatic but not magic. Scrap the > array controller approach. It won't work. Do an NSObjectController instead. > > Google "binding across nibs" (you may need to try a few variations on the > preposition for best results) and you will find numerous discussion and > techniques. > > Keary Suska > Esoteritech, Inc. > "Demystifying technology for your home or business" > > _______________________________________________ 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]
