サーバーの(phpファイル)からbase64で画像の文字列を取得したい。
しかし、この文字列をデコードし、画像に変換してUIImageに表示するものはわかりません。
サーバーの(phpファイル)からbase64で画像の文字列を取得したい。
しかし、この文字列をデコードし、画像に変換してUIImageに表示するものはわかりません。
NSURL *urlString = [NSURL URLWithString:@"your string"];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation([UIImage imageWithData:
[NSData dataWithContentsOfURL:urlString]])];
UIImage *image = [UIImage imageWithData:imageData];
これを試してみてください.....あなたにとって十分に使えるかもしれません.
NSData* data = UIImageJPEGRepresentation(yourImage, 1.0f);
NSString *strEncoded = [Base64 encode:data];
次のようにデコードします。
NSData* data = [Base64 decode:strEncoded ];;
image.image = [UIImage imageWithData:data];