Tôi đang cố gắng tạo chế độ xem bảng tùy chỉnh bằng cách sử dụng ô mà tôi đã tạo trong IB. Tôi gặp phải một lỗi lạ:Lỗi UITableViewCell tùy chỉnh
<BroadcastViewController 0x4b4f5f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key postText.
Mọi thứ được nối đúng trong IB với bộ điều khiển tế bào. Không thực sự chắc chắn tại sao điều này xảy ra.
Đây là những gì cellForRowAtIndexPath của tôi trông giống như:
- (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;
}
Bất cứ ai nhìn thấy loại hình báo lỗi trước? Hãy cho tôi biết nếu bạn cần thêm bất kỳ thông tin nào ...
Cần mã hoàn chỉnh cho hàm cellForRowAtIndexPath – SegFault
Đã được cập nhật. – gabaum10
Có vẻ như bạn đang cố gắng chèn một giá trị cho 'postText' vào thứ gì đó không phải là một NSDictionary? :) – willcodejavaforfood