【发布时间】:2015-05-13 04:11:49
【问题描述】:
我有ViewController1 和ViewController2。
ViewController1 是UICollectionView,它使用ASAssetLibrary 将缩略图加载到UICollectionViewCell:
NSMutableArray *collector = [[NSMutableArray alloc] initWithCapacity:0];
ALAssetsLibrary *al = [TemplateEditBarController defaultAssetsLibrary];
[al enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos
usingBlock:^(ALAssetsGroup *group, BOOL *stop)
{
[group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop)
{
if (asset) {
[collector addObject:asset];
}
}];
assetsarray = collector;//<--assetsarray is local.
}
failureBlock:^(NSError *error) { NSLog(@"fail!");}
];
当cell selected时,我想通过NSString或NSURL到ViewController2,使其调用并显示完整的分辨率图像。但是当NSLog这个网址:
ALAsset* asset = backgroundsarray[row];
ALAssetRepresentation *representation = [asset defaultRepresentation];
NSURL *url = [representation url];
newbg = [url absoluteString];//<-NSLog this.
我明白了:
assets-library://asset/asset.JPG?id=6E5438ED-9A8C-4ED0-9DEA-AB2D8F8A9360&ext=JPG
我尝试更改为[url path] 我得到了:
资产.JPG
如何获取实际的照片网址,以便我可以转换为NSString 以传递给ViewController2?
【问题讨论】:
标签: ios objective-c iphone