僅僅只是對值得遍歷,個人感覺用forin更有效率。
在使用forin進行遍歷循環,修改其中的值時,會報錯誤:
Collection <__NSArrayM: 0x7ffa5261aa70> was mutated while being enumerated
這時候就可以使用:
enumerateObjectsUsingBlock
這裏*stop就可以在你需要的時候終止遍歷,很方便
僅僅只是對值得遍歷,個人感覺用forin更有效率。
在使用forin進行遍歷循環,修改其中的值時,會報錯誤:
Collection <__NSArrayM: 0x7ffa5261aa70> was mutated while being enumerated
這時候就可以使用:
enumerateObjectsUsingBlock
這裏*stop就可以在你需要的時候終止遍歷,很方便