Re: Hove to retrieve 'living' objects [CoreData / Bindings] [SOLVED]
Re: Hove to retrieve 'living' objects [CoreData / Bindings] [SOLVED]
- Subject: Re: Hove to retrieve 'living' objects [CoreData / Bindings] [SOLVED]
- From: Stefan <email@hidden>
- Date: Tue, 6 Feb 2007 21:21:36 +0100
Am 06.02.2007 um 00:00 schrieb Stefan:
Using the below code, I try to get an ordered list of records:
>>>
- (NSArray *)getSortedTransactions {
NSManagedObjectContext *moc = [transactionsArrayControllerOutlet
managedObjectContext];
...
return array;
}
<<<
The actual objects returned are sorted. Unfortunately, I get
deleted records too, which
don't appear in the app's GUI's bound NSTableView. This behaviour
persists even if I
save the document and reload it again.
I retrieved managed objects using a bad starting point. This one
works as better:
>>>
// First create a sort descriptor, which sorts 'trDateCreated'
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]
initWithKey:@"trDateCreated" ascending:YES];
// Then ask the NSArrayController to use this description
[transactionsArrayControllerOutlet setSortDescriptors:[NSArray
arrayWithObject:sortDescriptor]];
// finally, get the sorted objects
return [transactionsArrayControllerOutlet arrangedObjects];
<<<
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden