ALAsset 的用法(时间、url 、图片的获取)

来源:互联网 发布:js array pushall 编辑:程序博客网 时间:2024/06/06 05:39
    ALAsset *asset = 对象;    //获取时间    NSDate* pictureDate = [asset valueForProperty:ALAssetPropertyDate];    NSDateFormatter * formatter = [[NSDateFormatter alloc]init];    formatter.dateFormat = @"yyyy:MM:dd HH:mm:ss";    formatter.timeZone = [NSTimeZone localTimeZone];//要换成本地的时区,才能获得正确的时间    NSString * pictureTime = [formatter stringFromDate:pictureDate];    //获取url:    NSURL *imageUrl = [[asset defaultRepresentation]url];    //获取缩略图:    CGImageRef  thumbnailRef = [asset thumbnail];    UIImage *thumbnailImg = [[UIImage alloc]initWithCGImage:thumbnailRef];    //获取全屏相片:    CGImageRef fullScreenRef = [[asset  defaultRepresentation]fullScreenImage];    UIImage *fullScreenImg = [[UIImage alloc]initWithCGImage:fullScreenRef];    //获取高清相片:    CGImageRef origionRef = [[asset  defaultRepresentation]fullResolutionImage];    UIImage *origionImg = [[UIImage alloc]initWithCGImage:origionRef];
0 0
原创粉丝点击