Ojbect-C2 3、NSArray和NSMutableArray数组的使用
Adopted Protocols
Tasks
Creating an Array
+ array+ arrayWithArray:--+ arrayWithContentsOfFile:--从文件中初始化数组+ arrayWithContentsOfURL:+ arrayWithObject:--只能初始化一个元素+ arrayWithObjects:--初始化多个元素+ arrayWithObjects:count:
Initializing an Array
– init– initWithArray:– initWithArray:copyItems:– initWithContentsOfFile:– initWithContentsOfURL:– initWithObjects:– initWithObjects:count:
Querying an Array
– containsObject:-- 是否包含字符串– count--获取元素中的个数– getObjects:range:– firstObject– lastObject– objectAtIndex:--访问数组中的某个元素– objectAtIndexedSubscript:– objectsAtIndexes:– objectEnumerator– reverseObjectEnumerator– getObjects:Deprecated in OS X v10.6
Finding Objects in an Array
– indexOfObject:– indexOfObject:inRange:– indexOfObjectIdenticalTo:– indexOfObjectIdenticalTo:inRange:– indexOfObjectPassingTest:– indexOfObjectWithOptions:passingTest:– indexOfObjectAtIndexes:options:passingTest:– indexesOfObjectsPassingTest:– indexesOfObjectsWithOptions:passingTest:– indexesOfObjectsAtIndexes:options:passingTest:– indexOfObject:inSortedRange:options:usingComparator:
Sending Messages to Elements
– makeObjectsPerformSelector:– makeObjectsPerformSelector:withObject:– enumerateObjectsUsingBlock:– enumerateObjectsWithOptions:usingBlock:– enumerateObjectsAtIndexes:options:usingBlock:
Comparing Arrays
Deriving New Arrays
– arrayByAddingObject:--追加数组的内容– arrayByAddingObjectsFromArray:– filteredArrayUsingPredicate:– subarrayWithRange:
Sorting
– sortedArrayHint– sortedArrayUsingFunction:context:– sortedArrayUsingFunction:context:hint:– sortedArrayUsingDescriptors:– sortedArrayUsingSelector:– sortedArrayUsingComparator:– sortedArrayWithOptions:usingComparator:
Working with String Elements
– componentsJoinedByString:-- 数组-->字符串
Creating a Description
– description– descriptionWithLocale:– descriptionWithLocale:indent:– writeToFile:atomically:– writeToURL:atomically:
Collecting Paths
Key-Value Observing
– addObserver:forKeyPath:options:context:– removeObserver:forKeyPath:– removeObserver:forKeyPath:context:– removeObserver:fromObjectsAtIndexes:forKeyPath:context:– addObserver:toObjectsAtIndexes:forKeyPath:options:context:– removeObserver:fromObjectsAtIndexes:forKeyPath:
Key-Value Coding
Tasks
Creating and Initializing a Mutable Array
Adding Objects
Removing Objects
– removeAllObjects– removeLastObject– removeObject:– removeObject:inRange:– removeObjectAtIndex:– removeObjectsAtIndexes:– removeObjectIdenticalTo:– removeObjectIdenticalTo:inRange:– removeObjectsInArray:– removeObjectsInRange:– removeObjectsFromIndices:numIndices:Deprecated
in OS X v10.6
Replacing Objects
– replaceObjectAtIndex:withObject:– setObject:atIndexedSubscript:– replaceObjectsAtIndexes:withObjects:– replaceObjectsInRange:withObjectsFromArray:range:– replaceObjectsInRange:withObjectsFromArray:– setArray:
Filtering Content
Rearranging Content
Class Methods
Ojbect-C2 3、NSArray和NSMutableArray数组的使用的更多相关文章
- iOS阶段学习第15天笔记(NSArray与NSMutableArray 数组)
iOS学习(OC语言)知识点整理 一.OC中的数组 1)数组:也是一个对象,数组中存放的是对象的地址,可以存放任意类型对象的地址,只能是对象不能是具体的数值,数组是有序的, 可以存放重复的元 ...
- NSArray与NSMutableArray 数组与可变数组
1.NSArray 是一个父类,NSMUtableArray是其子类,他们构成了OC的数组.2.NSArray的创建NSArray * array = [[NSArray alloc]initWith ...
- NSArray与NSMutableArray 数组与可变数组的创建和遍历 复习
1.NSArray 是一个父类,NSMUtableArray是其子类,他们构成了OC的数组. 2.NSArray的创建 NSArray * array = [[NSArray alloc]initWi ...
- IOS数组NSArray与NSMutableArray知识点
此文是对数组NSArray与NSMutableArray知识点的总结,主要是一些常见的操作,别外一些操作见其相应的文档,下面的代码部分还运用的第三方插件BlocksKit相结合: a:Foundati ...
- 15.Object-C--浅谈Foundation框架OC数组NSArray与NSMutableArray
昨天总结了一下NSString与NSMutableString,今天我在这里总结一下NSArray与NSMutableArray. NSArray数组是:不可变数组. nil 是数组元素结束的标记.O ...
- IOS - Objective-C NSArray和NSMutableArray的详解 使用
原文地址:http://blog.csdn.net/totogo2010/article/details/7729377 Objective-C的数组比C++,Java的数组强大在于,NSArray保 ...
- OC知识梳理-NSArray与NSMutableArray相关知识
知识普及: 1.数组中的元素在系统中都会有其默认对应的下标,下标是一个整形的数字,默认从0开始. 例:NSArray *arr3 = @["345","234" ...
- NSArray、NSMutableArray基本用法
NSArray.NSMutableArray基本用法 一.基本操作 初始化方法:1.init返回一个空数组 2.initWithArray从已有数组初始化 3.initWithContentsOfFi ...
- Objective-C语法之NSArray和NSMutableArray
转自:http://www.cnblogs.com/stoic/archive/2012/07/09/2582773.html Objective-C的数组比C++,Java的数组强大在于,NSArr ...
随机推荐
- RESTful风格的Web服务框架:Swagger
Swagger与SpringMVC项目整合 为了方便的管理项目中API接口,在网上找了好多关于API接口管理的资料,感觉目前最流行的莫过于Swagger了,功能强大,UI界面漂亮,并且支持在线测试等等 ...
- BZOJ1614: [Usaco2007 Jan]Telephone Lines架设电话线
1614: [Usaco2007 Jan]Telephone Lines架设电话线 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 892 Solved: ...
- 两次fopen不同的文件返回相同的FILE* 地址
最近接触一个垃圾程序,出现一个奇怪的bug,现象是两次fopen不同的文件返回相同的FILE*地址,第二次返回的FILE*有时候无端端的就被关闭了.以下代码是对这个bug的概括: auto fp1 = ...
- 【Mongous】write after end
执行1(---) 执行2(----) 完成1(POST) 执行3(---)
- Spark如何解决常见的Top N问题
需求 假设我们有一张各个产品线URL的访问记录表,该表仅仅有两个字段:product.url,我们需要统计各个产品线下访问次数前10的URL是哪些? 解决方案 (1)模拟访问记录数据 ...
- 【转】Log4cpp 封装
[转自]http://blog.csdn.net/ylioi/article/details/9049591 这篇文章对Log4cpp使用了宏定义和类进行封装,非常有借鉴意义. log4cpp 是参考 ...
- Git error: hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused b
hint: Updates were rejected because the remote contains work that you dohint: not have locally. This ...
- volley使用与解析(一)
1.什么是volley Volley是google发布的基于Android平台上的网络通信库,能使网络通信更快,更简单,更健壮.获取地址:git clone https://android.googl ...
- 如何正确并完全安装Visual Studio 2015企业版本[转]
http://blog.csdn.net/code_godfather/article/details/47381631 [注意事项]1> 本文描述的是: Visual Studio 2015企 ...
- SecondarySort 原理
定义IntPair 以及 IntPair(first,second)的compareto,先比較first的大小,再比較second的大小 定义FirstPartitioner是为了让partitio ...