【Foundation-10-4】#import <Foundation/NSArray.h>可变数组,一般
来源:互联网 发布:婚庆效果图设计软件 编辑:程序博客网 时间:2024/05/17 00:50
@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)numItemsNS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)aDecoderNS_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
- 【Foundation-10-4】#import <Foundation/NSArray.h>可变数组,一般
- 【Foundation-10-5】#import <Foundation/NSArray.h>可变数组,操作
- 【Foundation-10-1】#import <Foundation/NSArray.h>
- 【Foundation-10-2】#import <Foundation/NSArray.h>
- 【Foundation-10-3】#import <Foundation/NSArray.h>遍历
- 【Foundation-10-3】#import <Foundation/NSArray.h>排序
- 【Foundation-26-4】#import <Foundation/NSDictionary.h>可变字典初始化
- 【Foundaton-10-3】#import <Foundation/NSArray.h>字符串操作
- 【Foundation-37-2】#import <Foundation/NSIndexSet.h>可变索引集合
- 【Foundation-26-5】#import <Foundation/NSDictionary.h>可变字典,操作
- 【Foundation-86-2】#import <Foundation/NSValue.h>
- Foundation——NSArray(数组)
- Foundation Framework 数组 NSArray、NSMutableArray
- Foundation--NSArray
- Foundation NSArray
- Foundation-NSArray
- 4Foundation Kit2-NSArray NSEnumrator
- 【Foundation-36-1】#import <Foundation/NSIndexPath.h>树结构
- BZOJ 2588 Count on a tree 主席树
- Java学习笔记
- Objective-C 数组
- sudo:update-grub:找不到命令 这要怎么办?
- JavaWeb知识 - 分页
- 【Foundation-10-4】#import <Foundation/NSArray.h>可变数组,一般
- Java Thread.join()详解
- HTML Parsing Error: Unable to modify the parent container element before the child element is closed
- 谷歌开源项目Chromium的源码获取与项目构建(Win7+vs10/vs13)
- 伊斯坦布尔之旅第六天:大学和机场
- 简单说一些intent传值
- 【基础练习】【二分】codevs2188 最长上升子序列(限定元素)题解
- 基于两个条件同时排序的快速排序
- Xilinx Zynq Linux内核源码编译