hw20101103 2015-05-22 09:35
浏览 1209

请问一下,为什么我把系统相册中的gif保存到沙盒之后就变成了静态图片?

 ALAssetRepresentation *representation = [asset defaultRepresentation];
 NSString *document = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
            NSString *filePath = [document stringByAppendingPathComponent:representation.filename];
            Byte *buffer = (Byte*)malloc(representation.size);
            NSUInteger buffered = [representation getBytes:buffer fromOffset:0.0 length:representation.size error:nil];
            NSData *data = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
            [data writeToFile:filePath atomically:YES];
  • 写回答

0条回答 默认 最新

    报告相同问题?