I have a plist called People.plist
and I'm trying to populate an NSComboBox
called nameBox
. I can't find anything in the documentation that says how to do this or if it's even possible. I assume this is easy, but I can't seem to find anything anywhere that works.
How do I populate an NSComboBox using a plist?
This is what I have, but it doesn't seem to be working.
- (void)viewDidLoad {
[super viewDidLoad];
self.nameBox.delegate = self;
[_nameBox setUsesDataSource:NO];
NSString *path = [[NSBundle mainBundle] pathForResource:@"People" ofType:@"plist"];
NSMutableArray *contents = [NSMutableArray arrayWithContentsOfFile:path];
for (int i = 0; i < [contents count]; i++){
[_nameBox addItemWithObjectValue:[[contents objectAtIndex:i] objectForKey:@"Name"]];
}
}