常见的NSArray和NSMutableArray方法
来源:互联网 发布:成男捏脸数据 编辑:程序博客网 时间:2024/05/16 12:00
NSArray方法:
+ (id)arrayWithObjects:(id)firstObj, …nil
创建一个新数组, 逗号隔开,nil结尾.
- (BOOL)containsObject:(id)anObject
确定数组中是否包含对象anObject(是用isEqual方法)
- (NSUInteger)count
数组中元素的个数
- (NSUInteger)indexOfObject:(id)anObject
第一个包含anObject的元素索引号(使用isEqual方法)
- (id)objectAtIndex:(NSUInteger)index
存储在元素index的对象
- (void)makeObjectsPerformSelector:(SEL)aSelector
将aSelector指示的消息发送给数组中的每个元素
- (NSArray *)sortedArrayUsingSelector:(SEL)comparator
根据comparator指定的方法进行排序
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
将数组写入指定的文件中,如果flag为YES,那么应该先创建一个临时文件.
NSMutableArray方法
+(id) array
创建一个空数组(无需手动释放)
+ (id)arrayWithCapacity:(NSUInteger)size
使用指定的初始size创建一个数组
- (id)initWithCapacity:(NSUInteger)size
使用指定的初始size初始化新分配的数组
- (void)addObject:(id)anObject
将对象anObject添加到数组的末尾
- (void)insertObject:(id)anObject atIndex:(NSUInteger) index
将对象anObject插入数组的index元素
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject
将数组中序号为index的对象用anObject替换
- (void)removeObjectAtIndex:(NSUInteger)index
从数组中删除元素index,将序号为index+1的对象移至数组的结尾
- (void)removeObject:(id)anObject
从数组中删除所有anObject
- (void)sortUsingSelector:(SEL)comparator
用comparator指示的比较方法将组排序
+ (id)arrayWithObjects:(id)firstObj, …nil
创建一个新数组, 逗号隔开,nil结尾.
- (BOOL)containsObject:(id)anObject
确定数组中是否包含对象anObject(是用isEqual方法)
- (NSUInteger)count
数组中元素的个数
- (NSUInteger)indexOfObject:(id)anObject
第一个包含anObject的元素索引号(使用isEqual方法)
- (id)objectAtIndex:(NSUInteger)index
存储在元素index的对象
- (void)makeObjectsPerformSelector:(SEL)aSelector
将aSelector指示的消息发送给数组中的每个元素
- (NSArray *)sortedArrayUsingSelector:(SEL)comparator
根据comparator指定的方法进行排序
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
将数组写入指定的文件中,如果flag为YES,那么应该先创建一个临时文件.
NSMutableArray方法
+(id) array
创建一个空数组(无需手动释放)
+ (id)arrayWithCapacity:(NSUInteger)size
使用指定的初始size创建一个数组
- (id)initWithCapacity:(NSUInteger)size
使用指定的初始size初始化新分配的数组
- (void)addObject:(id)anObject
将对象anObject添加到数组的末尾
- (void)insertObject:(id)anObject atIndex:(NSUInteger) index
将对象anObject插入数组的index元素
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject
将数组中序号为index的对象用anObject替换
- (void)removeObjectAtIndex:(NSUInteger)index
从数组中删除元素index,将序号为index+1的对象移至数组的结尾
- (void)removeObject:(id)anObject
从数组中删除所有anObject
- (void)sortUsingSelector:(SEL)comparator
用comparator指示的比较方法将组排序
如何实现点击button,让光标自动调转到UITextView
- (void)ButtonClick:(id)sender {
[textView selectAll:sender];
}
[textView selectAll:sender];
}
- 常见的NSArray和NSMutableArray方法
- 常见的NSArray和NSMutableArray方法
- 常见的NSArray和NSMutableArray方法
- 常见的NSArray和NSMutableArray方法
- 常见的NSArray和NSMutableArray方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的常用方法
- ios NSArray和NSMutableArray的常用方法
- NSArray和NSMutableArray的用法
- NSArray和NSMutableArray的使用
- object—c 代理 协议 委托 数据源 概念
- WCF 4 Step By Step Chapter13 Note (Implementing a WCF Service for Good Performance)
- SDET系列课程第二部分圆满结束
- Android中引入第三方Jar包的方法(java.lang.NoClassDefFoundError解决办法)
- 我的时间管理
- 常见的NSArray和NSMutableArray方法
- unity3d 脚本基础认识3-动态产生GUI
- seasar自动注册成员变量
- 处理多维度变化——桥接模式(一)
- WindowsAPI使用详解——GetVersion|GetVersionEx 获取操作系统版本和名称
- 12.04.08 ~ 12.04.14
- 利用GZIP压缩网页来提升网站浏览速度(Tomcat,apache,iis)
- 第10章其他有用的层
- setlocale函数作用