Making an UIImage from byte string
I am paring a XML and getting an image in Byte form and I have put that in a string. Now I have to draw that image.
I have tried to use various methods开发者_JAVA技巧 but no success. How can I do this?
Try converting the string to NSData:
NSString* str= ....
NSData* data=[str dataUsingEncoding:NSUTF8StringEncoding];
Then take a look at:
UIImage *image = [[UIImage alloc] initWithData:data];
Hope this helps.
You can convert the byte into NSData and then you can get the image using
UIImage *image = [[UIImage alloc] initWithData:data];
OR
UIImage *image = [UIImage imageWithData:data];
精彩评论