我正在尝试使用 aUICollectionView
与 a 协作UICollectionViewCell
来显示图像的缩略图。我的UICollectionViewCell
应用程序中使用的是自定义(简单)子类:
#import "MemeCell.h"
@implementation MemeCell
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
-(void)setThumb:(UIImage *)image {
if (_thumb != image) {
_thumb = image;
}
_imageThumb.image = _thumb;
}
@end
在File's Owner
myUICollectionView
中,我使用:
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
static BOOL nibLoaded = NO;
if (!nibLoaded) {
UINib *cellNib = [UINib nibWithNibName:@"MemeCell" bundle:nil];
[_collectionView registerNib:cellNib forCellWithReuseIdentifier:@"MemeCell"];
nibLoaded = YES;
}
MemeCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"MemeCell" forIndexPath:indexPath];
NSString *path = [_imageThumbs objectAtIndex:indexPath.section];
UIImage *thumb = [UIImage imageNamed:path];
[cell setThumb:thumb];
return cell;
}
返回一个单元格。该视图在第一次呈现时工作正常,但在从它的委托调用中解散后[self dismissViewControllerAnimated:YES completion:nil]
,它不能再次呈现而不会崩溃
2013-03-10 22:11:35.448 CapifyPro[21115:907] -[UICollectionViewCell setThumb:]: unrecognized selector sent to instance 0x1e593320
2013-03-10 22:11:35.450 CapifyPro[21115:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICollectionViewCell setThumb:]: unrecognized selector sent to instance 0x1e593320'
任何人都可以提供见解吗?