标签:style blog color io ar strong sp div 2014
可变数组是不可变数组的子类, 它继承了不可变数组的所有方法的同时又有属于自己的方法, 比如修改数组里的元素, 为数组里添加元素等等.
涉及到的方法:
addObject: 意思就是添加数组元素.
下面我们来看看例子吧:
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { NSMutableArray *array = [[NSMutableArray alloc]init]; [array addObject:@"One"]; [array addObject:@"Tow"]; [array addObject:@"Three"]; NSLog(@"%@", array); [array release]; } return 0; }
输出的结果:
2014-10-13 20:02:44.925 NSMutableArray[6338:303] ( One, Tow, Three ) Program ended with exit code: 0
标签:style blog color io ar strong sp div 2014
原文地址:http://www.cnblogs.com/iOSCain/p/4022955.html