【发布时间】:2012-07-01 12:47:16
【问题描述】:
我有一系列构成 IBOutletCollection 一部分的 UILabel
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *labelCollection;
我已将 UILabels 的标签按顺序设置为 0、1、2、3 ...,并按标签号对 *labelCollection 进行了排序。因此,IBOutletCollection 数组中的对象“0”是带有标签“0”等的 UILabel。
使用以下函数,我可以在特定的 obj/tag 处更新 UILabel 的文本:
- (void) updateLabelAtTag:(int)objId {
[[self.labelCollection objectAtIndex:objId] setText:@"my new text"];
}
}
这很好,但是,当您在 IDE 中单击 setText: 时,Xcode Quick Help 会报错
setText:
@property(nonatomic, copy) NSString *text
iOS (2.0 and later)
Deprecated: Use the textLabel and detailTextLabel properties instead.
The text of the cell.
UITableViewCell.h
对于我的生活,我无法弄清楚 UITableViewCell 与这种情况有什么关系。我当然无法访问 textLabel 或 detailTextLabel 属性。
问题:我是在使用已弃用的属性,还是在这种情况下 Xcode 弄错了?
【问题讨论】:
标签: objective-c ios uilabel iboutletcollection