@interface NSMutableArray : NSArray
- (void)addObject:(id)anObject;
- (void)insertObject:(id)anObject atIndex:(NSUInteger)index;
- (void)removeLastObject;
- (void)removeObjectAtIndex:(NSUInteger)index;
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCapacity:(NSUInteger)numItems NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
@end
NSMutableArray *arr = [NSMutableArray array];//一般用这个就行了
NSMutableArray *arr2 = [[NSMutableArray alloc]initWithCapacity:0];//数组大小
// NSMutableArray *arr3 = [NSMutableArray alloc]initWithCoder:@""];
[arr addObject:@"1"];
[arr addObject:@"2"];
[arr addObject:@"3"];
[arr insertObject:@"4" atIndex:1];
[arr removeLastObject];
[arr removeObjectAtIndex:0];
[arr replaceObjectAtIndex:0 withObject:@"??"];
NSLog(@"%@",arr);
@interface NSMutableArray (NSMutableArrayCreation)
+ (instancetype)arrayWithCapacity:(NSUInteger)numItems;
+ (NSMutableArray *)arrayWithContentsOfFile:(NSString *)path;
+ (NSMutableArray *)arrayWithContentsOfURL:(NSURL *)url;
- (NSMutableArray *)initWithContentsOfFile:(NSString *)path;
- (NSMutableArray *)initWithContentsOfURL:(NSURL *)url;
NSString *path = [[NSBundle mainBundle]pathForResource:@"testArray" ofType:@"plist"];
NSMutableArray *arr0 = [NSMutableArray arrayWithCapacity:0];
arr0 = [NSMutableArray arrayWithContentsOfFile:path]; // 类方法
// arr0 = [[NSMutableArray alloc]initWithContentsOfFile:path]; //实例方法
NSLog(@"%@",arr0);
获取URL 类似
@end