::edit - solved.. I had not conformed to NSComboBoxDataSource properly..
I have an NSComboBox implementation that works - except - when the data source is changed, the changes are not reflected in the combo box until the app is restarted. I have [myComboBox reloadData]
plastered all over the place, but this is not effective. Any ideas what I should look for?
The data source is marked in IB:
The following data source methods are implemented:
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)categoryCombo{
//NSLog(@"categoryMutableArray count: %lu", (unsigned long)categoryMutableArray.count);
return categoryMutableArray.count;
}
- (id)comboBox:(NSComboBox *)categoryCombo objectValueForItemAtIndex:(NSInteger)row {
//NSLog(@"%s", __FUNCTION__);
[self refreshCategories:nil];
currentCategory = [categoryMutableArray objectAtIndex:row];
mainCategory.stringValue = [currentCategory valueForKey:@"catName"];
return mainCategory.stringValue;
}
- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
//NSLog(@"%s", __FUNCTION__);
currentItem = [mainMutableArray objectAtIndex:rowNumber];
//[self.mainCategory setStringValue:
// [NSString stringWithFormat: @"%@", [categoryMutableArray objectAtIndex: [(NSComboBox *)[notification object] indexOfSelectedItem]]]];
currentCategory = [categoryMutableArray objectAtIndex: [(NSComboBox *)[notification object] indexOfSelectedItem]];
NSString *newCatString = [currentCategory valueForKey:@"catName"];
[currentItem setObject:newCatString forKey:@"category"];
[currentItem saveInBackground];
//NSLog(@"new category name may be: %@",[currentDream valueForKey:@"category"]);
}