在这里,我指向了Referencing Outlet Collection
。我无法弄清楚它在 XCode4 中的用法。
我要求 XCode4 的 InterfaceBuilder 中的“REFERENCING OUTLET COLLECTION 的新功能”。
最佳答案
IBOutletCollection
是一种对IBOutlets
进行分组的方法。假设您有 3 或 4 个 UILabels
,您将在其上应用样式(字体、背景颜色、不透明度等)。使用 IBOutletCollection
,执行此操作变得微不足道。首先,您需要定义您的 IBOutletCollection
:
@property (nonatomic, retain) IBOutletCollection(UILabel) NSArray *labelsCollection;
(注意我们放在括号内的类型,尽管如果我们有一个混合集合,我们可以放一个 id
)
在 Interface Builder 上连接 IBoutlets
,然后迭代它:
for(UILabel *label in labelsCollection)
{
// Apply your styles
}
希望这可以帮助您理解:
http://useyourloaf.com/blog/2011/3/28/interface-builder-outlet-collections.html
关于ios - Xcode4 Interface Builder 中的引用 socket 集合是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6649391/