Я не знаком с именами методов, которые вы используете, в моем случае мне нужно было создать пользовательский класс ячеек табличного представления вне класса tableview,
класс называется QRTYPECELL и следующие коды:
@implementation QRTypeCell
@synthesize imageView;
@synthesize labelview;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
imageView = nil;
labelview= nil;
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,30,30)];
imageView.contentMode = UIViewContentModeCenter;
[self.contentView addSubview:imageView];
self.contentView.backgroundColor = [UIColor blackColor];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.textColor = [UIColor greenColor];
label.backgroundColor = [UIColor blackColor];
label.font = [UIFont systemFontOfSize:17];
self.labelview = label;
[self.contentView addSubview:label];
}
return self;}
А затем в классе TableView:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
QRTypeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[QRTypeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];}
CurrentQRCode = (QRCode *)[fetchedResultsController objectAtIndexPath:indexPath];
NSString *icon = CurrentQRCode.parsed_icon;
NSString *string = CurrentQRCode.parsed_string;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
NSString *filePath = [[NSBundle mainBundle] pathForResource:icon ofType:@"png"];
UIImage *image_file = [UIImage imageWithContentsOfFile:filePath];