iosuitableviewuikituinib

Wrong type given when loading UITableViewCell subclass from a nib


The following assertion is failing:

NSString *class = NSStringFromClass([RCTReceiptOptionsCell class]);
RCTReceiptOptionsCell *cell = [[[NSBundle mainBundle] loadNibNamed:class owner:self options:nil] objectAtIndex:0];
NSAssert([cell isKindOfClass:[RCTReceiptOptionsCell class]], @"cell is wrong class dummy");

I am trying to create a UITableView cell subclass from a nib and this has worked for me in the past. Now the method returns a UIView in iOS 6.1. Any ideas on how to fix this?


Solution

  • Make sure that the class of the root object in the nib is set to RCTReceiptOptionsCell rather than the default value of UIView.