I\'m not sure where the error is here, having looked at other similar issues. I received an Assertion failure.
Terminating app due to uncaught exception \'N
You need to call "initWithStyle" in custom TableViewCell and initialise the objects again.
Example: ProductTableViewCell.m file
@implementation ProductTableViewCell
- (void)awakeFromNib {
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
_titleLabel = [[UILabel alloc] initWithFrame:(CGRectMake(70, 0, 320, 60))];
[self.contentView addSubview:_titleLabel];
}
return self;
}
In the main implementation file
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
ProductTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"productTableViewCell"];
NSDictionary *dic = nil;
if (tableView == self.searchDisplayController.searchResultsTableView) {
dic = [_filteredArray objectAtIndex:indexPath.row];
} else {
dic = [_originalArray objectAtIndex:indexPath.row];
}
cell.titleLabel.text = [dic objectForKey: @"title"];
return cell;
}