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 ...
随机推荐
- Android 正则表达式匹配汉字中文
关于中文的正则表达式, 应该是^[\\u4E00-\\u9FFF]+$, 和论坛里常被人提起的^[\\u4E00-\\u9FA5]+$很接近需要注意的是论坛里说的^[\\u4E00-\\u9FA5]+ ...
- android——彻底关闭——应用程序
最近学习做android的游戏开发时候,发现一个关于android退出时不能彻底关闭的问题,比如:一个程序里new 出了N多个Thread,这样在退出程序的可能不能完全关闭,最后发现,只用finish ...
- android.graphics.Matrix
Matrix类包含了一个3x3的矩阵用来改变坐标,它没有一个构造器来初始化它里边的内容,所以创建实例后需要调用reset()方法生成一个标准matrix,或者调用set..一类的函数,比如setTra ...
- TimePicker,TimePickerDialog以及自定义timepicker(一)
场景:在activity上点击,弹出一个dialog,然后点击dialog上的一个按钮,在弹出时间.以及自定义dialog 懒,要用到一个选择时间的需求,只要求小时和分钟,弹出式,第一时间想到了tim ...
- 增加几个entity framework 的函数 (记录备忘)[转]
public static class DatabaseExtensions { public static DataTable SqlQueryForDataTatable(this Databas ...
- leetcode distinct-subsequences(DP)
参考https://oj.leetcode.com/problems/distinct-subsequences 动态规划方程 dp[i][j]=dp[i-1][j-1]+dp[i-1][j] (s( ...
- TCP HTTP 详细内存分析 & time_wait setsockopt
http://www.kegel.com/c10k.html#nb.edge http://www.chinasb.org/archives/2012/11/4954.shtml UDP协议:发送进程 ...
- php环境下ckeditor和ckfinder的配置详解
摘要:老牌编辑器FCK的升级版CKEditor(http://ckeditor.com/) 经过重写,提供了丰富而强大的集成和互动的API.新版编辑器是完全基于插件,它可以扩展所有部件以符合需求.FC ...
- [置顶] linux下让php支持mysql——寻找消失的mysql
问题 最近我都在忙一个课件录制系统.这两天发现其中服务器端的一个更新数据库的php脚本运行有问题,一些本应该是系统自带函数却无法运行.于是我展开了调查... 服务器端是centos系统,其中ph ...
- 来看看Github上流行的编码规范
Popular Coding Convention on Github是一个有趣的网站,它根据Github的代码提交情况分析了几种语言流行的代码规范,目前支持对JavaScript,Java,Py ...