NSMutable Arayソート

3215 ワード

http://iphone.ipsw.info/2009/10/nsmutablearray.html
-(NSAray*)ソテグラーUsingSelector:(SEL)comprator Parameters
comprator
A selector that dentifies the method to use e to compre two elements at a time.The method shoud return NSOrderedAcending if the receiver is smaler than the argment、  NSOrderedDescending if the receiver is larger than the argment,and  NSOrderedSame if they are equal
NSArray *sortedArray = 
    [anArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
@property (nonatomic) readwrite retain)NSMutable Aray*parameters;
[self.parameters] sortUsingSelector:@selector(compre:);
 
癜pragmamamamamamark-(NSComprisoResoult)compare:(id)inObject{     NSCompparionResoult result=[self.name] compare:[(MPURL Request Parameeter) *)inObject name;;     if (reult== NSOrderedSame){relt=[self.value] compare:[(MPURL Request Parameeter) *)inObject value;;     }         return result;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Obj 1, id。 Obj 2, void *context){NSDate*d 1=[(Message Group*)obj 1 latestTime;NSDate*d 2=[(Message Group*)obj 2 latestTime;//sort by desc return [d 2] compre:d 1];NSInteger dateSort(id) Obj 1, id。 Obj 2, void *context){NSDate*d 1=(Inbox*)obj 1).datetime;NSDate*d 2=(Inbox*)obj 2).datetime;return [d 1] compare:d 2]//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [グループメッセンジャー] allValues] sortedArayUsingFunction:sortObjects ByLatestTimecontext:NULL;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// *レギオンズ = [NSMutable Aray] array;;NSSortDescripter *sortDescriptor=[NSSortDescriptor] alloc] initwithKey:@name ascending:YES;NSAray *sortDescriptors=[NSAray] arrayWithObject:sortDescriptor;[regions] sortUsingDescriptors:sortDescriptors;[sortDescriptor] リリース;