#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { NSArray * array = [[NSArray alloc]initWithObjects:@"one one",@"Two",@"Three", nil]; //快速枚举法 for (NSString * temp in array) { NSLog(@"%@",temp); } //枚举器法 NSEnumerator * myenum = [array objectEnumerator]; id obj; while (obj = [myenum nextObject]) { NSLog(@"%@",obj); } //下标法 for (int i=0; i<[array count]; i++) { NSLog(@"%@",[array objectAtIndex:i]); } } return 0; }
时间: 2024-11-08 18:59:38