我正在構建一個簡單的基於導航的應用程序使用表。iPhone - 「類」可能不響應「方法」
我有一個自定義「UITableViewCell」來自定義下面附加的表格單元格數據。
@interface NewsCell : UITableViewCell
{
IBOutlet UILabel *newsTitle;
}
- (void)setNewsLabel:(NSString *)title;
@end
然後在我的RootViewController的,我在「的cellForRowAtIndexPath」方法設置標籤「newsTitle」的文字如下。
static NSString *MyIdentifier = @"MyIdentifier";
MyIdentifier = @"NewsCell";
NewsCell *cell = (NewsCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(cell == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"NewsCell" owner:self options:nil];
cell = newsCell;
}
[cell setNewsLabel:@"hello testing"];
return cell;
當我運行此,應用程序運行正常,但我得到「NewsCell可能不迴應‘-setNewsLabel:’」的警告。
請幫忙!謝謝。
xib中的標識符字符串與「MyIdentifier」相同嗎? – AechoLiu 2010-09-01 13:42:28
是........還是不行。 – ericbae 2010-09-01 13:51:03