这是我的代码。我在 iOS 项目中使用它,它在 UITableView 上运行良好,但由于某种原因UIViewContentModeScaleAspectFit
,setminificationfilter:kCAFilterTrilinear
部分代码似乎无法正常工作。
我在 tvOS 上做错了吗?或者这是一个可能的错误?有人可以确认他们是否看到同样的问题吗?谢谢。
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
Movie *movie = [self.filteredmovies objectAtIndex:indexPath.row];
// Set the item image
__weak UIImageView *anImageView = (UIImageView *)[cell.contentView viewWithTag:1];
anImageView.contentMode = UIViewContentModeScaleAspectFit;
[anImageView.layer setMinificationFilter:kCAFilterTrilinear];
[anImageView sd_setImageWithURL:movie.coverURL
placeholderImage:[UIImage imageNamed:@"loading"]
options:SDWebImageHighPriority | SDWebImageRetryFailed
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL)
{
if (image == nil || error) {
[anImageView setImage:[UIImage imageNamed:@"Image_Not_Found"]];
}
}];
return cell;
}