开发者

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜