WEB开发网
开发学院手机开发iPhone 开发 NSString+NSMutableString+NSValue+NSAraay用法汇... 阅读

NSString+NSMutableString+NSValue+NSAraay用法汇总

 2010-09-16 23:54:00 来源:WEB开发网   
核心提示://- (void) addObject: (id) anObject;//NSMutableArray *array = [NSMutableArray arrayWithObjects:@"One",@"Two",@"Three",nil];[array

//- (void) addObject: (id) anObject;

//NSMutableArray *array = [NSMutableArray arrayWithObjects:

@"One",@"Two",@"Three",nil];

[array addObject:@"Four"];

NSLog(@"array:%@",array);

/*-------------- 删除数组中指定索引处对象----------------*/

//-(void) removeObjectAtIndex: (unsigned) index;

//NSMutableArray *array = [NSMutableArray arrayWithObjects:

@"One",@"Two",@"Three",nil];

[array removeObjectAtIndex:1];

NSLog(@"array:%@",array);

/*------------- 数组枚举---------------*/

//- (NSEnumerator *)objectEnumerator;从前向后

//NSMutableArray *array = [NSMutableArray arrayWithObjects:

@"One",@"Two",@"Three",nil];

NSEnumerator *enumerator;

enumerator = [array objectEnumerator];

id thingie;

while (thingie = [enumerator nextObject]) {

NSLog(@"thingie:%@",thingie);

}

//- (NSEnumerator *)reverseObjectEnumerator;从后向前

//NSMutableArray *array = [NSMutableArray arrayWithObjects:

@"One",@"Two",@"Three",nil];

NSEnumerator *enumerator;

enumerator = [array reverseObjectEnumerator];

id object;

while (object = [enumerator nextObject]) {

NSLog(@"object:%@",object);

}

//快速枚举

//NSMutableArray *array = [NSMutableArray arrayWithObjects:

@"One",@"Two",@"Three",nil];

for(NSString *string in array)

{

NSLog(@"string:%@",string);

}

/*****************************************************************************

NSDictionary

***************************************************************************/

/*------------------------------------创建字典 ------------------------------------*/

//- (id) initWithObjectsAndKeys;

上一页  1 2 3 4 5 6 7 8 9 10  下一页

Tags:NSString NSMutableString NSValue

编辑录入:coldstar [复制链接] [打 印]
赞助商链接