Created
May 12, 2009 08:45
-
-
Save akio0911/110395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
int main(){ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSArray * array = [NSArray arrayWithObjects: | |
[NSNumber numberWithInt:333], | |
[NSNumber numberWithInt:555], | |
[NSNumber numberWithInt:444], | |
[NSNumber numberWithInt:222], | |
[NSNumber numberWithInt:111], | |
nil]; | |
int min = [[array valueForKeyPath:@"@min.intValue"] intValue]; | |
int max = [[array valueForKeyPath:@"@max.intValue"] intValue]; | |
NSLog(@"min = %d", min); | |
NSLog(@"max = %d", max); | |
NSUInteger minIndex = [array indexOfObject:[NSNumber numberWithInt:min]]; | |
NSUInteger maxIndex = [array indexOfObject:[NSNumber numberWithInt:max]]; | |
NSLog(@"minIndex = %d", minIndex); | |
NSLog(@"maxIndex = %d", maxIndex); | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment