1

我用这个标题阅读了所有问题。FavoritosViewController.m 我有:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
favcolCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"fav" forIndexPath:indexPath];
[[cell imageCell]setImage:[UIImage imageNamed:[arrayimages objectAtIndex:indexPath.item]]];
return cell;
}

在 favcolCell.h 我有:

@property (retain, nonatomic) IBOutlet UIImageView *imageCell;

在 favcolCell.m 我有:

    @synthesize imageCell;

(...)

- (void)dealloc {
    [imageCell release];
    [super dealloc];
}

我错过了什么?

编辑:

解决方案:进行正确的班级注册。

4

2 回答 2

10

我错过了这个:

[self.collectionView registerClass:[FavoritosRestViewCell class] forCellWithReuseIdentifier:@"fav"];

关于ViewDidLoad方法。我注册了错误的课程。感谢用户 HotLicks。

于 2013-03-10T16:03:27.687 回答
0

对我来说,这是解决方案..

我在单元格内拍摄了一个集合视图和 imageView。但我忘了在界面(故事板)文件中设置标签。

故事板-> 集合视图-> 图像视图-> 属性检查器-> 在此处设置标签。

我希望它可以帮助某人。

于 2015-04-15T07:01:46.007 回答