Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我了解该stop参数的用途,但我很好奇为什么这是 aBOOL *而不仅仅是 BOOL。是因为值本身需要存在于块范围之外,因此可以enumerateObjectsUsingBlock:访问块本身可能分配给它的值吗?
stop
BOOL *
enumerateObjectsUsingBlock:
要回答您的问题(虽然它看起来像一个骗子),该块需要告诉它的调用者停止枚举,如果它找到了它正在寻找的东西。C中有两种选择:
return YES
return NO
Apple 选择了第二种方法,尽管我认为第一种方法既简单(少一个参数)也更直观。
不能只是BOOL设置变量的本地副本,而不是调用者范围内的变量。
BOOL