图片转base64字符串
by 伍雪颖
- (NSString *)base64String:(UIImage *)image { NSData * data = [UIImagePNGRepresentation(image) base64EncodedDataWithOptions:NSDataBase64Encoding64CharacterLineLength]; return [NSString stringWithUTF8String:[data bytes]]; }
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:shareEntity.photoContentStr options:1]; UIImage *image = [UIImage imageWithData:decodedData];
时间: 2024-10-10 15:15:41