如何从 asset url 获取 UIImage 对象
我正在使用 ALAsset 框架从图像库中选择多个图像。我想将选定的图像存储到数据库中。然后,这些存储的图像将用于显示图像的幻灯片。我的问题是,我将图像 URL 存储到数据库中,URL 的格式为 - assets-library://asset/asset.JPG?id=1000000007&ext=JPG
。现在为了显示图像,我需要 UIImage 对象,那么如何从这种 URL 创建 UIImage 对象。我已经尝试过 -
for(NSDictionary *dict in info)
{
NSString* path = [[NSString alloc] initWithString:[dict objectForKey:@"UIImagePickerControllerReferenceURL"]];
UIImage* ui;
ui = [[UIImage alloc] initWithContentsOfFile:path];
}
这没有用。请有人告诉我该怎么做..
I am using ALAsset framework for selecting multiple images from the image library. I want to store the selected images into the database. These stored images are then to be used to show the slideshow of the images. My problem i am storing the image URL into the database, URL is in format - assets-library://asset/asset.JPG?id=1000000007&ext=JPG
. Now for displaying the images i need UIImage object, so how do i create a UIImage object from this kind of URL. I have tried -
for(NSDictionary *dict in info)
{
NSString* path = [[NSString alloc] initWithString:[dict objectForKey:@"UIImagePickerControllerReferenceURL"]];
UIImage* ui;
ui = [[UIImage alloc] initWithContentsOfFile:path];
}
This did not worked. Please some one tell me how do i do it..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论