【发布时间】:2013-01-31 14:26:40
【问题描述】:
我正在尝试使用以下代码将MPMediaItemArtwork Image 输入UITableView's 单元格的 ImageView。
MPMediaItemArtwork *artwork = [[[self.arrayOfAlbums objectAtIndex:indexPath.row] representativeItem]valueForProperty:MPMediaItemPropertyArtwork];
UIImage *artworkImage = [artwork imageWithSize: cell.imageView.bounds.size];
if (artworkImage)
{
cell.imageView.image = artworkImage;
}
else
{
cell.imageView.image = [UIImage imageNamed: @"noArtwork.png"];
}
当我在UITableView's 单元格ImageView 中插入Artwork 图像时没问题。
但是当我的作品图像太小或太大时,就像下图一样。 没有完全填满cell的ImageView。
你看到了吗?我想像 iOS Music App 一样设置 Stretch 填充
这是设置完全填充Stretch的内置应用艺术作品图片
我想那样做。
所以我使用了cell.imageView.contentMode = UIViewContentModeScaleAspectFill;,但它没有效果。
那我该怎么做呢? 谢谢你的工作。
【问题讨论】:
标签: ios cocoa-touch uitableview mpmediaitem artwork