我正嘗試使用我在IB中構建的單元格來構建自定義表格視圖。我收到一個奇怪的錯誤:自定義UITableViewCell錯誤
<BroadcastViewController 0x4b4f5f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key postText.
在IB中,一切都正確連接到單元控制器。不知道爲什麼會發生這種情況。
這是我的cellForRowAtIndexPath是什麼樣子:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the folder object of interest
Broadcast *messageAtIndex = [self.messages objectAtIndex:indexPath.row] ;
static NSString *CellIdentifier = @"BroadcastTableViewCell";
static NSString *CellNib = @"BroadcastTableViewCell";
BroadcastTableViewCell *cell = (BroadcastTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//ERRORING ON THIS LINE...
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil];
cell = (BroadcastTableViewCell *)[nib objectAtIndex:0];
}
cell.postText.text = messageAtIndex.replyText;
cell.authorName.text = messageAtIndex.postCreatorFirstName;
cell.postDate.text = messageAtIndex.creationDate;
return cell;
}
沒有人見過這種類型的錯誤?如果您需要更多信息,請告知我...
需要功能的完整代碼cellForRowAtIndexPath – SegFault 2010-10-15 14:17:31
已更新。 – gabaum10 2010-10-15 14:23:00
看起來你試圖爲'postText'插入一個不是NSDictionary的東西? :) – willcodejavaforfood 2010-10-15 14:25:28