MPMediaItemArtwork 上的 ImageWithSize 返回非常小的封面图像(55 x 55 像素)
我正在尝试在 Monotouch 中创建一个非常简单的音乐播放器(适合小孩子),并且它的大部分工作得很好。
然而,当我迭代播放列表中的 MPMediaItems 并尝试获取其艺术作品时,我总是得到尺寸为 55 x 55 像素的图像。当我在内置 iPod 应用程序中收听歌曲时,我可以看到存储的艺术作品比这要大。
平台:最新的 monodevelop 和 monotouch。设备上的 iOS 4.2.3
用于获取播放列表中第一首歌曲的艺术作品的代码:
MPMediaItem[] songs = foundPlaylist.Items;
MPMediaItemArtwork artwork = (MPMediaItemArtwork)songs[0].ValueForProperty(MPMediaItemProperty.Artwork);
var imageRect = artwork.ImageCropRectangle;
UIImage artWorkImage = artwork.ImageWithSize (imageRect);
我在这里很困惑。有什么想法吗?
最好的问候
索伦
I am trying to create a very simple music player (for small children) in Monotouch and have most of it working just great.
However when I iterate through MPMediaItems in a playlist and try to get their artwork I always get an image with size 55 x 55 pixels. When I listen to the songs in the builtin IPod application I can see that the stored artwork is larger than that.
Platform: Latest monodevelop and monotouch. iOS 4.2.3 on device
Code to get artwork of the first song in a playlist:
MPMediaItem[] songs = foundPlaylist.Items;
MPMediaItemArtwork artwork = (MPMediaItemArtwork)songs[0].ValueForProperty(MPMediaItemProperty.Artwork);
var imageRect = artwork.ImageCropRectangle;
UIImage artWorkImage = artwork.ImageWithSize (imageRect);
Am pretty stumped here. Any ideas?
Best regards
Soren
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
奥基,明白了。
非常感谢 Kangaroo 的单点触控聊天功能!
MPMediaItemArtwork 上的 imageWithSize 方法存在绑定错误,因此您需要直接向选择器发送消息。这是通过以下方式完成的(获得 256x256 图像):
Oki, got it figured out.
Big thanks to Kangaroo on the monotouch chat!
There is a binding error in the imageWithSize method on MPMediaItemArtwork, so you need to message the selector directly. This is done in this way (to get a 256x256 image):