now, i've been reading just about everything about NSArrayController.
i have properly setup my xib, the NSArrayController, NSTableView and the bindings -- everything's working except for one odd behavior of my NSTableView.
First some code to picture the scene:
@implementation MyAppDelegate
@synthesize arrayController, dataArray;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.dataArray = [NSMutableArray array];
}
- (IBAction)myControllerAddAction:(id)sender {
NSString *val = [[NSDate date] description];
NSMutableDictionary *item = [NSMutableDictionary dictionaryWithObjectsAndKeys:val, @"date", nil];
[serversController addObject:item];
}
- (IBAction)myArrayAddAction:(id)sender {
NSString *val = [[NSDate date] description];
NSMutableDictionary *item = [NSMutableDictionary dictionaryWithObjectsAndKeys:val, @"date", nil];
[[self mutableArrayValueForKey:@"dataArray"] addObject:item];
}
@end
using -mutableArrayValueForKey:@"myNSArrayControllerStore"
and adding objects via the returned NSMutableArray
proxy's -addObject:myDictionary
the array controller instructs the table view to draw the new content but it'll select all rows with the same values in their NSCell
s:
using the array controller's -addObject:myDictionary
it'll draw the new row and select the newly added one:
(on both screens i've been continuously clicking multiple times per second)
Why is that?
Do i need to handle proper row selection on my own when using [NSMutableArray -addObject:]
?
Or is this a bug?
Mac OS 10.7.3
Xcode 4.3
Base SDK 10.7
Deployment target 10.6