我在继承一个程序中的某些代码时会遇到一些问题。Objective C关键字'in'
CGPoint tapLocation = [gesture locationInView:self.view];
for (UIView *view in self.view.subviews){
if (!CGRectContainsPoint(view.frame, tapLocation)){
//do something
}
}
问题是我不知道关键字'in'在做什么。我搜索了四周,只能找到一些不起眼的参考和post here。
的帖子说:
in: argument is an input argument only and won’t be referenced later
我实在不明白这是如何应用到上面的代码。任何帮助将不胜感激。
看起来链接不再有效。我发现目前最相关的Mac Cocoa Core Competencies文档:https://developer.apple.com/library/mac/documentation/General/Conceptual/DevPedia-CocoaCore/Enumeration.html他们对Fast的解释枚举:“快速枚举 - 包括集合类的几个Cocoa类采用NSFastEnumeration协议,用它来检索实例所拥有的元素,使用类似于标准C for循环的语法” –