help with bindings
help with bindings
- Subject: help with bindings
- From: Rounak Jain <email@hidden>
- Date: Sun, 21 Nov 2010 09:30:28 +0530
#import <Cocoa/Cocoa.h>
@interface ComboscAppDelegate : NSObject <NSApplicationDelegate> {
IBOutlet NSComboBox *countryCombo;
NSMutableDictionary *theCountries;
NSArray *myKeys;
IBOutlet NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
- (void)applicationWillFinishLaunching:(NSNotification *)notif;
@end
#import "ComboscAppDelegate.h"
@implementation ComboscAppDelegate
@synthesize window;
- (void)applicationWillFinishLaunching:(NSNotification *)notif {
theCountries = [[NSMutableDictionary alloc] init];
[theCountries setValue:[NSMutableArray arrayWithObjects:@"AAABBB", @"AABBB", @"AAACCC", nil] forKey:@"A"];
[theCountries setValue:[NSMutableArray arrayWithObjects:@"BBBAAA", @"BBBBBBBB", @"BBBCCC", nil] forKey:@"B"];
[theCountries setValue:[NSMutableArray arrayWithObjects:@"CCCDDD", @"CCFGGGFF", @"CCCDDDFFF", nil] forKey:@"C"];
[theCountries setValue:[NSMutableArray arrayWithObjects:@"T", nil] forKey:@"T"];
myKeys = [[NSArray alloc]init];
myKeys = [theCountries allKeys];
}
@end
Please tell me the binding connections I must make so that I see the Keys of "theCountries" (i.e. myKeys) in the drop-down of countryCombo.
I tried using NSArrayController but could not get it right. Please guide me.
(Also, is there a way to reduce the four theCountries setValue: statements to one?)
_______________________________________________
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