Thanks Jerry,
I have used the dictionaryWithObjectsAndKeys: method.
I have implemented your suggestions regarding "convenience constructors" and
myKeys object. Regarding your comment about making everything "mutable", I
think, at the moment, it has to be that way.
What's next?
#import <Cocoa/Cocoa.h>
@interface ComboscAppDelegate : NSObject <NSApplicationDelegate> {
IBOutlet NSComboBox *countryCombo;
NSMutableDictionary *theCountries;
NSMutableArray *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 dictionaryWithObjectsAndKeys:
[NSMutableArray
arrayWithObjects:@"AAABBB", @"AABBB", @"AAACCC", nil], @"A",
[NSMutableArray
arrayWithObjects:@"BBBAAA", @"BBBBBBBB", @"BBBCCC", nil], @"B",
[NSMutableArray
arrayWithObjects:@"CCCDDD", @"CCFGGGFF", @"CCCDDDFFF", nil], @"C", nil];
myKeys = [NSMutableArray arrayWithObjects: [theCountries allKeys], nil];
}
@end
_______________________________________________
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]