【发布时间】:2013-03-21 21:56:02
【问题描述】:
我的班级有一个 NSArray 类型的属性,称为“歌曲”。我正在为它创建一个自定义 getter,XCode 为我提供了一个创建方法的选项:
songsAtIndexes:(NSIndexSet *)indexes
这是什么,为什么 XCode 提供这个?这是特定于 NSArray 属性的吗?为该方法创建方法/getter 的目的是什么?如果我不手动定义,会不会自动创建/合成?
【问题讨论】:
-
Xcode 可能只是巧妙地结合了变量名并试图弄清楚你想要做什么。
-
其实是KVC的结果:developer.apple.com/library/ios/#documentation/cocoa/conceptual/…,
Or implement the method -countOf<Key> and one or both of -objectIn<Key>AtIndex: or -<key>AtIndexes:. -
我认为这适用于 KVO/KVC
标签: ios objective-c xcode autocomplete nsarray