在做遍历的时候,除了for循环 for..in这两种基本的方法以外,还有一种更高效的方法——“块枚举法”
NSArray


使用这种方法可以同时知道“值”以及和它相对应的下标,obj为值 idx为小标 stop为判断终止遍历的条件 相当于break 上面例子的输出入下

当数组取到值为5的时候 就不再执行了。
NSDictionary


NSSet


在做遍历的时候,除了for循环 for..in这两种基本的方法以外,还有一种更高效的方法——“块枚举法”
NSArray
使用这种方法可以同时知道“值”以及和它相对应的下标,obj为值 idx为小标 stop为判断终止遍历的条件 相当于break 上面例子的输出入下
当数组取到值为5的时候 就不再执行了。
NSDictionary
NSSet
本文标题:OC中NSArray 、NSDictionary、 NSSet
本文链接:https://www.haomeiwen.com/subject/ffxxxqtx.html
网友评论