UIImage* pic =[UIImage imageNamed:@"image.png"];
NSData *pictureData = UIImageJPEGRepresentation(pic, 1.0); 或者使用NSData* pictureData =UIImagePNGRepresentation(pic);(二者看需求选取)
NSString* pictureString =[pictureData base64Encoding];
转回来:
UIImage* image =[UIImage imageWithData:[NSData dataFromBase64EncodedString: pictureString]];