【发布时间】:2016-10-14 14:40:36
【问题描述】:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
[_keyboard.collectionView registerClass:[NibCell class] forCellWithReuseIdentifier:@"Cell"];
static NSString *identifier = @"Cell";
NibCell *cell = [self.keyboard.collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
UIImageView * rampageGifImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, cell.frame.size.width, cell.frame.size.height)];
[rampageGifImage setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@.gif",[rampageGif objectAtIndex:indexPath.row]]]];
[cell.layer setCornerRadius:4];
[cell addSubview:rampageGifImage];
return cell;
}
【问题讨论】:
-
您不能在原生视图中使用 gif。为此使用 webView ,或者如果您真的想展示它,请使用一个打破图像并重新激活它的库。 github.com/Flipboard/FLAnimatedImage
标签: ios objective-c iphone uicollectionview gif