2012-07-01 39 views
0

的一部分,我有一系列形成的IBOutletCollection什麼是設置一個UILabel這是一個IBOutletCollection

@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *labelCollection; 

我已經相繼設置UILabels的標籤0份UILabels的文本的正確方法, 1,2,3 ...並且我通過標籤號對* labelCollection進行了排序。因此,IBOutletCollection陣列中,對象「0」是用的UILabel標籤「0」等

使用下面的函數I可以在特定的obj /標籤更新的UILabel的文本:

- (void) updateLabelAtTag:(int)objId { 
     [[self.labelCollection objectAtIndex:objId] setText:@"my new text"]; 
    } 

} 

這工作得很好,但是,當你點擊的setText:在IDE中,Xcode的快速幫助抱怨

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在這種情況下出錯了?

回答

2

Xcode。我懷疑

[(UILabel *)[self.labelCollection objectAtIndex:objId] setText:@"my new text"]; 

會讓它消失。

+0

是的!你是對的。我應該想到要施展它。 +1更多咖啡。 –

相關問題