カスタムTableViewCellを持つtableViewがあります。これをレイアウトするために .xib ファイルを使用していません。問題は、テーブルが読み込まれるはずのときに、次のエラーが表示されるTerminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage nsli_superitem]: unrecognized selector sent to instance 0x91899b0'
ことです。ここで何が間違っているのかわかりません。セルの .m ファイルは次のとおりです。
#import "TCMExhibitListCell.h"
@implementation TCMExhibitListCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setListImage:[[UIImage alloc] init]];
[self setTitleLabel:[[UILabel alloc] init]];
NSDictionary *names = @{@"listImage" : [self listImage]};
NSString *fmt = @"H:|-0-[listImage]";
NSArray *imgH = [NSLayoutConstraint constraintsWithVisualFormat:fmt
options:0
metrics:nil
views:names];
[[self contentView] addConstraints:imgH];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
テーブルビューコントローラーでセルが読み込まれる場所は次のとおりです
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TCMExhibitListCell *c = [tableView dequeueReusableCellWithIdentifier:@"TCMExhibitListCell"];
if (!c) {
c = [[TCMExhibitListCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"TCMExhibitListCell"];
}
TCMExhibitRemote *e = [[self exhibits] objectAtIndex:[indexPath row]];
NSString *imageFile = [NSString stringWithFormat:@"%@/%@.jpg",[[TCMExhibitFeedStore sharedStore] imagePathByType:@"listImage"],[e image]];
[c setListImage:[UIImage imageNamed:imageFile]];
return c;
}