@interface NSArray<__covariant ObjectType> : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>@property (readonly) NSUInteger count;
/*
返回位于指定索引处的对象。如果index超出数组的末尾(也就是说,如果index大于或等于count返回的值),则会引发NSRangeException。
*/
- (ObjectType)objectAtIndex:(NSUInteger)index;
/*
初始化一个空的数组
*/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
/*
描述 :初始化新分配的数组,以包含给定C数组中给定数量的对象。
元素以与它们在对象中出现的顺序相同的顺序添加到新数组中,直到但不包括索引计数。
以这种方式初始化一个不可变数组之后,就不能修改了。
这个方法是一个指定的初始化器。
参数
objects : C对象的数组。
cnt : 要包含在新数组中的对象C数组中的值的数量。 这个数字将是新数组的数量 - 它不能是负数或大于对象中元素的数量。
instancetype : 新分配的数组,包括来自对象的第一个计数对象。 返回的对象可能与原始接收者不同。
*/
- (instancetype)initWithObjects:(const ObjectType _Nonnull [_Nullable])objects count:(NSUInteger)cnt NS_DESIGNATED_INITIALIZER;
/*
返回从给定的unarchiver中的数据初始化的对象。你通常从initWithCoder返回自我: 如果你有一个提前的需求,需要在解码后替换一个不同的对象,你可以在方法awakeAfterUsingCoder :中做这些.
*/
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;@end
复制代码
@interface NSArray<ObjectType> (NSExtendedArray)
/*
返回一个新的数组,该数组是接收数组与给定的对象添加到结尾形成新数组的copy(复制)。如果anObject为空,则引发NSInvalidArgumentException异常。
*/
- (NSArray<ObjectType> *)arrayByAddingObject:(ObjectType)anObject;
/*
返回一个新的数组,它是接收数组的copy,会将其他数组中包含的对象添加到结尾。
*/
- (NSArray<ObjectType> *)arrayByAddingObjectsFromArray:(NSArray<ObjectType> *)otherArray;
/*
构造并返回NSString对象,该对象是在数组元素之间插入给定分隔符的结果。 如果数组没有元素,则返回表示空字符串的NSString对象。注意:separator 可以是@"";
*/
- (NSString *)componentsJoinedByString:(NSString *)separator;
/*
返回一个布尔值,该值指示数组中是否存在给定的对象。
从索引0开始,检查数组中的每个元素与anObject是否相等,直到找到匹配或到达数组的末尾。 如果isEqual对象被认为是相等的:返回YES。
*/
- (BOOL)containsObject:(ObjectType)anObject;
/*
表示数组内容的字符串,格式化为属性列表。
*/
@property (readonly, copy) NSString *description;
/*
*/
- (NSString *)descriptionWithLocale:(nullable id)locale;
/*
*/
- (NSString *)descriptionWithLocale:(nullable id)locale indent:(NSUInteger)level;
/*
*/
- (nullable ObjectType)firstObjectCommonWithArray:(NSArray<ObjectType> *)otherArray;
/*
*/
- (void)getObjects:(ObjectType _Nonnull __unsafe_unretained [_Nonnull])objects range:(NSRange)range NS_SWIFT_UNAVAILABLE("Use 'subarrayWithRange()' instead");
/*
*/
- (NSUInteger)indexOfObject:(ObjectType)anObject;
/*
*/
- (NSUInteger)indexOfObject:(ObjectType)anObject inRange:(NSRange)range;
/*
*/
- (NSUInteger)indexOfObjectIdenticalTo:(ObjectType)anObject;
/*
*/
- (NSUInteger)indexOfObjectIdenticalTo:(ObjectType)anObject inRange:(NSRange)range;
/*
*/
- (BOOL)isEqualToArray:(NSArray<ObjectType> *)otherArray;
@property (nullable, nonatomic, readonly) ObjectType firstObject API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
@property (nullable, nonatomic, readonly) ObjectType lastObject;
- (NSEnumerator<ObjectType> *)objectEnumerator;
- (NSEnumerator<ObjectType> *)reverseObjectEnumerator;
@property (readonly, copy) NSData *sortedArrayHint;
/*
*/
- (NSArray<ObjectType> *)sortedArrayUsingFunction:(NSInteger (NS_NOESCAPE *)(ObjectType, ObjectType, void * _Nullable))comparator context:(nullable void *)context;
/*
*/
- (NSArray<ObjectType> *)sortedArrayUsingFunction:(NSInteger (NS_NOESCAPE *)(ObjectType, ObjectType, void * _Nullable))comparator context:(nullable void *)context hint:(nullable NSData *)hint;
/*
*/
- (NSArray<ObjectType> *)sortedArrayUsingSelector:(SEL)comparator;
/*
*/
- (NSArray<ObjectType> *)subarrayWithRange:(NSRange)range;
/* Serializes this instance to the specified URL in the NSPropertyList format (using NSPropertyListXMLFormat_v1_0). For other formats use NSPropertyListSerialization directly. */
/*
*/
- (BOOL)writeToURL:(NSURL *)url error:(NSError **)error API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0));/*
*/
- (void)makeObjectsPerformSelector:(SEL)aSelector NS_SWIFT_UNAVAILABLE("Use enumerateObjectsUsingBlock: or a for loop instead");
/*
*/
- (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(nullable id)argument NS_SWIFT_UNAVAILABLE("Use enumerateObjectsUsingBlock: or a for loop instead");
/*
*/
- (NSArray<ObjectType> *)objectsAtIndexes:(NSIndexSet *)indexes;
/*
*/
- (ObjectType)objectAtIndexedSubscript:(NSUInteger)idx API_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/*
*/
- (void)enumerateObjectsUsingBlock:(void (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))block API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))block API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (void)enumerateObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts usingBlock:(void (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))block API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSUInteger)indexOfObjectPassingTest:(BOOL (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))predicate API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSUInteger)indexOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))predicate API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSUInteger)indexOfObjectAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE^)(ObjectType obj, NSUInteger idx, BOOL *stop))predicate API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSIndexSet *)indexesOfObjectsPassingTest:(BOOL (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))predicate API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSIndexSet *)indexesOfObjectsWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))predicate API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSIndexSet *)indexesOfObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(ObjectType obj, NSUInteger idx, BOOL *stop))predicate API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSArray<ObjectType> *)sortedArrayUsingComparator:(NSComparator NS_NOESCAPE)cmptr API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (NSArray<ObjectType> *)sortedArrayWithOptions:(NSSortOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmptr API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));typedef NS_OPTIONS(NSUInteger, NSBinarySearchingOptions) {NSBinarySearchingFirstEqual = (1UL << 8),NSBinarySearchingLastEqual = (1UL << 9),NSBinarySearchingInsertionIndex = (1UL << 10),
};
/*
*/
- (NSUInteger)indexOfObject:(ObjectType)obj inSortedRange:(NSRange)r options:(NSBinarySearchingOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmp API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)); // binary search@end
复制代码
@interface NSArray<ObjectType> (NSArrayCreation)
/*
*/
+ (instancetype)array;
/*
*/
+ (instancetype)arrayWithObject:(ObjectType)anObject;
/*
*/
+ (instancetype)arrayWithObjects:(const ObjectType _Nonnull [_Nonnull])objects count:(NSUInteger)cnt;
/*
*/
+ (instancetype)arrayWithObjects:(ObjectType)firstObj, ... NS_REQUIRES_NIL_TERMINATION;
/*
*/
+ (instancetype)arrayWithArray:(NSArray<ObjectType> *)array;
/*
*/
- (instancetype)initWithObjects:(ObjectType)firstObj, ... NS_REQUIRES_NIL_TERMINATION;
/*
*/
- (instancetype)initWithArray:(NSArray<ObjectType> *)array;
/*
*/
- (instancetype)initWithArray:(NSArray<ObjectType> *)array copyItems:(BOOL)flag;/* Reads array stored in NSPropertyList format from the specified url. */
/*
*/
- (nullable NSArray<ObjectType> *)initWithContentsOfURL:(NSURL *)url error:(NSError **)error  API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0));/* Reads array stored in NSPropertyList format from the specified url. */
/*
*/
+ (nullable NSArray<ObjectType> *)arrayWithContentsOfURL:(NSURL *)url error:(NSError **)error API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) NS_SWIFT_UNAVAILABLE("Use initializer instead");@end
复制代码
@interface NSArray<ObjectType> (NSDeprecated)/*这种方法是不安全的,因为它可能会导致缓冲区溢出。 您应该使用-getObjects:range:来代替。
*/
- (void)getObjects:(ObjectType _Nonnull __unsafe_unretained [_Nonnull])objects NS_SWIFT_UNAVAILABLE("Use 'as [AnyObject]' instead") API_DEPRECATED("Use -getObjects:range: instead", macos(10.0, 10.13), ios(2.0, 11.0), watchos(2.0, 4.0), tvos(9.0, 11.0));/* 这些方法已被弃用,并将在后续版本中标记为API_DEPRECATED。使用方法的变体 */
+ (nullable NSArray<ObjectType> *)arrayWithContentsOfFile:(NSString *)path;
+ (nullable NSArray<ObjectType> *)arrayWithContentsOfURL:(NSURL *)url;
- (nullable NSArray<ObjectType> *)initWithContentsOfFile:(NSString *)path;
- (nullable NSArray<ObjectType> *)initWithContentsOfURL:(NSURL *)url;
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile;
- (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically;@end
复制代码
/****************   Mutable Array       ****************/@interface NSMutableArray<ObjectType> : NSArray<ObjectType>
/*
*/
- (void)addObject:(ObjectType)anObject;
/*
*/
- (void)insertObject:(ObjectType)anObject atIndex:(NSUInteger)index;
/*
*/
- (void)removeLastObject;
/*
*/
- (void)removeObjectAtIndex:(NSUInteger)index;
/*
*/
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(ObjectType)anObject;
/*
*/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
/*
*/
- (instancetype)initWithCapacity:(NSUInteger)numItems NS_DESIGNATED_INITIALIZER;
/*
*/
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;@end
复制代码
@interface NSMutableArray<ObjectType> (NSExtendedMutableArray)/*
*/
- (void)addObjectsFromArray:(NSArray<ObjectType> *)otherArray;
/*
*/
- (void)exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2;
/*
*/
- (void)removeAllObjects;
/*
*/
- (void)removeObject:(ObjectType)anObject inRange:(NSRange)range;
/*
*/
- (void)removeObject:(ObjectType)anObject;
/*
*/
- (void)removeObjectIdenticalTo:(ObjectType)anObject inRange:(NSRange)range;
/*
*/
- (void)removeObjectIdenticalTo:(ObjectType)anObject;
/*
*/
- (void)removeObjectsFromIndices:(NSUInteger *)indices numIndices:(NSUInteger)cnt API_DEPRECATED("Not supported", macos(10.0,10.6), ios(2.0,4.0), watchos(2.0,2.0), tvos(9.0,9.0));
/*
*/
- (void)removeObjectsInArray:(NSArray<ObjectType> *)otherArray;
/*
*/
- (void)removeObjectsInRange:(NSRange)range;
/*
*/
- (void)replaceObjectsInRange:(NSRange)range withObjectsFromArray:(NSArray<ObjectType> *)otherArray range:(NSRange)otherRange;
/*
*/
- (void)replaceObjectsInRange:(NSRange)range withObjectsFromArray:(NSArray<ObjectType> *)otherArray;
/*
*/
- (void)setArray:(NSArray<ObjectType> *)otherArray;
/*
*/
- (void)sortUsingFunction:(NSInteger (NS_NOESCAPE *)(ObjectType,  ObjectType, void * _Nullable))compare context:(nullable void *)context;
/*
*/
- (void)sortUsingSelector:(SEL)comparator;
/*
*/
- (void)insertObjects:(NSArray<ObjectType> *)objects atIndexes:(NSIndexSet *)indexes;
/*
*/
- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes;
/*
*/
- (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withObjects:(NSArray<ObjectType> *)objects;
/*
*/
- (void)setObject:(ObjectType)obj atIndexedSubscript:(NSUInteger)idx API_AVAILABLE(macos(10.8), ios(6.0), watchos(2.0), tvos(9.0));
/*
*/
- (void)sortUsingComparator:(NSComparator NS_NOESCAPE)cmptr API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
/*
*/
- (void)sortWithOptions:(NSSortOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmptr API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));@end
复制代码
@interface NSMutableArray<ObjectType> (NSMutableArrayCreation)
/*
*/
+ (instancetype)arrayWithCapacity:(NSUInteger)numItems;
/*
*/
+ (nullable NSMutableArray<ObjectType> *)arrayWithContentsOfFile:(NSString *)path;
/*
*/
+ (nullable NSMutableArray<ObjectType> *)arrayWithContentsOfURL:(NSURL *)url;
/*
*/
- (nullable NSMutableArray<ObjectType> *)initWithContentsOfFile:(NSString *)path;
/*
*/
- (nullable NSMutableArray<ObjectType> *)initWithContentsOfURL:(NSURL *)url;@end
复制代码

iOS 深入解析之NSArray相关推荐

  1. [iOS] dom解析xml数据,拿到lt;gt;里面的值

    [iOS] dom解析xml数据,拿到<>里面的值 <response result="success" timestamp="1338890206&q ...

  2. iOS中解析json数据

    同Android中的jsonarray和jsonobject相同,iOS中json分为nsarray和jsonobject, []--------jsonarray/nsarray; {}------ ...

  3. iOS 歌词解析(lrc, 非谓词, 仿QQ音乐, 仿卡拉ok模式)

    前言 要解析 lrc 格式的歌词, 首先需要知道什么是 lrc 歌词, 还需要知道 lrc 歌词的规范. 在这里先放出一个百度百科的链接地址, 仅供大家参考: 百度百科: lrc 关于本文 本文的歌词 ...

  4. iOS开发中对NSArray或者NSMutableArray中的内容排序

    原文引用至               http://blog.unieagle.net/2012/05/10/ios开发中对nsarray或者nsmutablearray中的内容排序/ NSMuta ...

  5. 苹果手机充值显示服务器异常,梦幻西游手游充值出现异常的iOS系统解析

    梦幻西游手游充值出现异常的iOS系统解析,目前iOS系统充值出现异常,如果您在充值时遇到 "iOS目前无法处理您的购买" 的问题,这个情况主要是由于苹果服务器存在问题导致的,目前会 ...

  6. iOS之解析ips文件

    iOS之解析ips文件 导出ips文件 dSYM配合 symbolicatecrash配合 执行解析 导出ips文件 途径一: 手机连接Xcode查看和导出 Xcode -> Window -& ...

  7. iOS JSON解析 NSJSONReadingMutableContainers的作用:

    转载自:   http://www.cnblogs.com/linyc/p/4272060.html 首先用代码来说明NSJSONReadingMutableContainers的作用: 1 NSSt ...

  8. ios markdown 解析_Shortcuts 教程:正则表达式修改 Markdown 链接

    这是我的「写作流」Shortcuts. 上一篇文章中,我谈到由于官方编辑器完全不支持 Markdown 语法,我不得不利用 Shortcut 以及公众号 Web API 处理 Markdown 文本的 ...

  9. ios网址解析中,中文部分如何处理

    在网络解析中,中文出现的时候,在解析数据是中文会显示为 %E7%81%AB%E5%BD%B1%E5%BF%8D%E8%80%85 这样的形式但是如果我们之间用字符串拼接键值对的时候但多数出现的不是错误 ...

最新文章

  1. 1043 输出PATest
  2. always@( )列表里不能同时有电平敏感事件和边沿触发事件
  3. OC中的自动引用计数
  4. 想成为别人眼里的Python大牛,就必不可少的书单
  5. Scala伴生类与伴生对象:apply方法/伴生对象可以访问伴生类的私有属性
  6. 采用8种相位,每种相位各有两种幅度的QAM调制方法,在1200Baud的信号传输速率下能达到的网数据传输速率为( )
  7. 用SMTP,POP3访问Exchange邮箱:Exchange2003系列之六
  8. SAP CRM business partner determination原理介绍
  9. 橡皮筋还能发动载人飞行器?
  10. [C1] 优化 C1FlexGrid 单元格边框
  11. C和指针之学习笔记(3)
  12. 如何清空c盘只剩系统_C盘满了怎么办?除了重装系统,还有这些办法!
  13. 洛谷——P1867 【Mc生存】经验值
  14. java单例模式的7种实现方式
  15. Centos解决ppp: compressor dropped pkt
  16. 不足300的游戏蓝牙耳机靠谱吗?五款高人气蓝牙耳机测评
  17. redhat7 虚拟机 取消屏幕保护或自动休眠时间
  18. 关于SWAT模型的一些原理(一)
  19. C笔试题:IP地址(点分十进制)转换为十进制数
  20. ggplot2_coor_xxx()坐标系变换

热门文章

  1. C语言程序设计 C语言中的时间函数
  2. win10计算机添加右键菜单,win10系统如何对鼠标右键菜单进行手动管理和添加
  3. c#如何wmf图片转换成png图片_每日一学:如何将png图片转换为jpg图片
  4. python如何测试仪器_使用python检测一个设备是否ping的通
  5. c语言常量结构体的成员,c语言之结构体
  6. oracle实现主键自动增长
  7. Error during artifact deployment. See server log for details解决办法
  8. openwrt系统安装到云服务器异常,OpenWrt路由器系统下服务OpenClash 安装教程及其折腾踩坑记录...
  9. resultset需要关闭吗_旧电脑福音!关闭Windows这些没用的设置,电脑性能至少提升50%!...
  10. Mysql Incorrect string value问题解决