Here is my problem: I have a Core Data- Document based program with ARC ( Automatic Reference Counting); I want the tableView shows some data at the beginning. but I receive nothing. Here is what I have done:
1- I made a core data with Entity: MyData
2- then I added a NSArrayController and bound it to managedObjectContext and MyData
3- I bonded the arrayController to col0:
4- then made and outlet and added @synthesize for the arrayController :
5- Finally added this code:
(void)windowControllerDidLoadNib:(NSWindowController *)aController {
[super windowControllerDidLoadNib:aController];
for (NSUInteger i=0; i<5; i++) {
[myArrayController add:self]; [myArrayController setSelectionIndex: i]; [myArrayController setValue:@"test" forKeyPath:@"selection.col0"]; NSLog(@"%lu",[myArrayController selectionIndex]);
} }
But this is the problem: nothing happens and the SelectionIndex shows strange numbers!!
Any help appreciated