ALAsset是什么?

来源:互联网 发布:淘宝客白菜qq群推广 编辑:程序博客网 时间:2024/06/03 16:19

最近有工作要推荐,iOS工程师,要找工作的同学加微信公众账号:iOSDevTip




获得的ALAsset对象就是相片对象:其中有相片的缩略图,全屏图,高清图,url等属性。

ALAsset *result = [assets objectAtIndex:index];

获取url:

String类型:

NSString *url = [[[result

defaultRepresentation]url]description];

URL类型:

NSURL *url = [[result defaultRepresentation]url];

获取缩略图:

CGImageRef  ref = [result thumbnail];

UIImage *img = [[UIImage alloc]initWithCGImage:ref];

获取全屏相片:

CGImageRef ref = [[result  defaultRepresentation]fullScreenImage];

UIImage *img = [[UIImage alloc]initWithCGImage:ref];

获取高清相片:

CGImageRef ref = [[result  defaultRepresentation]fullResolutionImage];

UIImage *img = [[UIImage alloc]initWithCGImage:ref];

0 0