0427 base64

//UIImage图片转成Base64字符串:
UIImage *originImage = [UIImage imageNamed:@"originImage.png"];
NSData *data = UIImageJPEGRepresentation(originImage, 1.0f);
NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
     
//Base64字符串转UIImage图片:
NSData *decodedImageData = [[NSData alloc] 
initWithBase64EncodedString:encodedImageStr options:NSDataBase64DecodingIgnoreUnknownCharacters];
UIImage *decodedImage = [UIImage imageWithData:decodedImageData];
posted @ 2016-04-27 13:08  zhen_zhen  阅读(95)  评论(0编辑  收藏  举报