UITableViewCell custom error

I am trying to create a custom table view using the cell that I created in IB. I get a weird error:

<BroadcastViewController 0x4b4f5f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key postText.

Everything is correctly connected in IB to the cell controller. Not quite sure why this is happening.

Here is what my cellForRowAtIndexPath looks like:

- (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;

}

Has anyone seen such an error before? Let me know if you need more information ...

+5
source share
3 answers

What is really strange is that he complains that the class BroadcastViewControllerdoes not comply with KVC postText.

, postText - , IBOutlet BroadcastTableViewCell. , postText IB. , , IBOutlet , , IB. , - . , , , NIB, .

+5

, - dequeueReusableCellWithIdentifier, UITableViewCell *.

:

UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier...
CustomCell* acell = (CustomCell*)cell; 

.

NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:nil options:nil]; 
+1

. IB . , . , . !

+1
source

All Articles