I've a custom table view cell that I created using XIB:
I've also linked up the XIB file with my custom UITableView cell.
But now when I try to load the cell in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
with the following codes:
MyCustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
// Load the top-level objects from the custom cell XIB.
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomTableViewCell" owner:cell options:nil];
// Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
cell = [topLevelObjects objectAtIndex:1];
}
I'll get a [<NSObject 0x8a5b970> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key hitMeButton.
I have been searching online and one of the possible reasons might be that the XIB is not linked to the IBOutlet, I've checked so that doesn't seem to be the case.
The real problem is how you've linked the outlets. You have to link your Outlets from the TableViewCell to labels in your cell (you probably linked the label at the File owner's)
Here some more explicative images :
This is ok
This is wrong
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With