Bindings: NSMutableArray -> NSArrayController -> NSPopUp
Bindings: NSMutableArray -> NSArrayController -> NSPopUp
- Subject: Bindings: NSMutableArray -> NSArrayController -> NSPopUp
- From: Charles Jenkins <email@hidden>
- Date: Sun, 17 Jan 2010 15:17:38 -0500
I am struggling with bindings. I have worked through the examples in the Hillegass book, but it seems that none of the examples using NSPopUp quite matches what I need.
In my app, just before a view appears, it gets handed a list of games in an NSMutableArray. It makes the array available with -(NSMutableArray*)gameList. I want the NSPopUp to contain a list showing the value of -(NSString*)description for each item in the list.
I thought I was supposed to do this by adding an NSArrayController to my .nib file, and then making the following bindings:
Array Controller's Content Array = File's Owner.gameList
NSPopUp's Content = Array Controller.arrangedObjects
At runtime I get a totally empty popup. I can imagine two possibilities for why it doesn't work:
a) I've got the bindings wrong
b) The array controller can't handle the fact that the gameList pointer changes right before the view gets shown
Can anyone help me get this working?
-------------------------------
Just in case it helps pre-answer any questions you may have, here are minimal descriptions of my classes:
@interface GameScores {
}
-(NSString*)description;
@end
@interface GameViewController {
NSMutableArray* gameList;
}
@property (retain) NSMutableArray* gameList;
@end
In the .nib file, NSArrayController tries to manage File's Owner.gameList, and the NSPopUp is supposed to display the NSArrayControler's arrangedObjects.
_______________________________________________
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