【发布时间】:2016-01-04 03:37:03
【问题描述】:
有没有人用 PFQueryCollectionViewController 用 Objective C 加载图像?
当用户第一次加载视图时,它会加载文本,但不会加载图像。用户第二次加载视图时,图像被加载。我不明白。
- (PFCollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
object:(PFObject *)object {
PFCollectionViewCell *cell = [super collectionView:collectionView cellForItemAtIndexPath:indexPath object:object];
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.textLabel.text = object[@"name"];
cell.imageView.file = object[@"icon"];
// If the image is nil - set the placeholder
if (cell.imageView.image == nil) {
cell.imageView.image = [UIImage imageNamed:@"Icon.png"];
[cell.imageView loadInBackground];
}
cell.contentView.layer.borderWidth = 1.0f;
cell.contentView.layer.borderColor = [UIColor clearColor].CGColor;
return cell;
}
【问题讨论】:
标签: ios objective-c parse-platform pfimageview