常见的NSArray和NSMutableArray方法
来源:互联网 发布:淘宝销售属性怎么填写 编辑:程序博客网 时间:2024/05/19 02:45
常见的NSArray和NSMutableArray方法
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的使用
- mySQL常用SQL语句技法
- tomcat 设置内存大小
- java关键字
- hadoop 排序
- S3C2440上LCD驱动(FrameBuffer)实例开发讲解
- 常见的NSArray和NSMutableArray方法
- Install VNC on Aix
- 修改分区大小on Aix
- Android 完美退出 App (Exit)
- AOM studio (eclispe)参数设置
- hadoop 大全
- win7 64位搭建Mantis 缺陷管理系统(2)--配置及问题修复
- 使用iOS手势UIGestureRecognizer
- python模块之smtplib: 用python发送SSL/TLS安全邮件