• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Sorting the NSSet of a NSManagedObject's attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting the NSSet of a NSManagedObject's attribute


  • Subject: Sorting the NSSet of a NSManagedObject's attribute
  • From: Gustavo Pizano <email@hidden>
  • Date: Sat, 15 May 2010 19:42:52 +0200

Hello all.

this is a silly question, I have a Entity Invoice with a to Many relation to ItemsXInvoice and this one a to-One relation to Item.. so kinda ItemsXInvoice its  join table,

so I want to ask from my Invoice its ItemXInvoice's but ordered, I overwrote the accessor.. like this

-(NSSet *) toItemsXInvoice{
	NSSet * toRet = [self primitiveValueForKey:@"toItemsXInvoice"];
	NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey:@"toItem.descr" ascending:YES] autorelease];
	NSSet * sortedtoRet = [NSSet setWithArray:[[toRet allObjects] sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]]];
	return sortedtoRet;
}

but :S.. of course it doesn't work,
I read I can apply to the NSFetchRequest the NSSortDEscriptor, but I already have the Invoice fetched from the NSArrayController of invoices...

What shall I modify in the accesor  in order to get always  ordered the ItemsXInvoice NSSet form the instance of Invoice?...

Thanks

Gustavo

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

  • Follow-Ups:
    • Re: Sorting the NSSet of a NSManagedObject's attribute
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Forcing ordered-out-window to adjust position
  • Next by Date: Re: Forcing ordered-out-window to adjust position
  • Previous by thread: Re: Forcing ordered-out-window to adjust position
  • Next by thread: Re: Sorting the NSSet of a NSManagedObject's attribute
  • Index(es):
    • Date
    • Thread