【发布时间】:2011-10-06 02:45:25
【问题描述】:
我有三个 UILabel 像这样连接到 IBOutletCollection:
@property (nonatomic, retain) IBOutletCollection(UILabel) NSArray *pids;
在 File's Owner 的 Connections Inspector 中,有一个带有三个标签的 Outlet Collection“pids”,所以我相信一切都已正确连接。我要做的是根据参数i 为这些标签中的特定标签设置文本,如下所示:
- (void)display:(NSInteger) i
{
NSLog([[pids objectAtIndex:i] text]);
[[pids objectAtIndex:i] setText: @"test"];
}
但这不起作用。每个 UILabel 都有一些默认文本,我尝试使用 NSLog 显示这些文本,但这不会输出任何内容。如果pids 是这些标签的 NSArray,为什么上面的代码没有做任何事情?谢谢!
【问题讨论】:
标签: iphone objective-c xcode interface-builder nsarray