在我的应用程序中,我在一个按钮上显示专辑图稿。在iPhone 5上,按钮边界大小为273x269.5。我的代码大小的艺术作品一直非常简单,没有任何改变。imageWithSize在iOS8中使用MPMediaItemArtwork的Flakey
MPMediaItem *currentItem = [musicPlayer nowPlayingItem];
MPMediaItemArtwork *iTunesArtwork = [currentItem valueForProperty: MPMediaItemPropertyArtwork];
CGSize buttonBounds = self.albumArtworkButton.bounds.size;
UIImage *resizedImage = [iTunesArtwork imageWithSize: CGSizeMake (buttonBounds.width, buttonBounds.height)];
突然与iOS8,执行此结果resizedImage = nil。什么是真正奇怪的是,如果我改变的最后一行,下面一行的执行:
UIImage *resizedImage = [iTunesArtwork imageWithSize: CGSizeMake (300, 300)];
导致有效的图像(即resizedImage不是零,可以显示的图像)。
任何想法可能会导致这种情况?我没有改变任何东西,但代码破裂了。
在imageView上设置contentMode并不能解决问题。你有袖手旁观吗?不幸的是,手动调整原始大小的图像的速度非常缓慢。 – wstr 2015-07-08 17:15:46