i have a NSArray and arrays are numbers like this;
NSArray *ratio = [NSArray arrayWithObjects:@"99",@"88",@"77", @"66", @"55", @"44",@"33", @"22",@"11",@"0",@"-11",@"-22",@"-33",@"-44",@"-55",@"-66",@"-77",@"-88",@"-99",@"-100",nil];
i want to take biggest object 99 and smallest object -100 hiw can i do this ?
i will use if condition biggest object like this ;
if ([[ratio objectAtIndex:i] intValue] == 100 ) {
rd = 0;
gr = 0.5;
bl =0;
}
//i want to do this
if ([[ratio objectAtIndex:i] intValue] == biggestobject or smallestobject ) {
///.....
}
Help pls myfriends:( - Now solve problem but there is a another problem at follows.
Second one problem :(
NSSortDescriptor* sortOrder = [NSSortDescriptor sortDescriptorWithKey: @"self" ascending: NO];
NSLog(@"%@",[ratio sortedArrayUsingDescriptors: [NSArray arrayWithObject: sortOrder]]);
i sorted array but cannot choose biggest and smallest object from array. How can i do this?
NSLog screen is following like this; 99, 99, 99, 91, 91, 88, 88, 88, 88, 77, 77, 66, 66, 66,
how can i take objectforkey:0 at sorted array