making UIImage from bytes
I have some data that is coming in xml tag from server and is in byte form i have to convert it to UIImage I have tried various links on google and also here but no help...
I have used
`NSData *fileData = [NSData dataWithBase64EncodedString:@"/qf20+EWOfpJfj开发者_如何学编程rUaU6n1fSRjXF8ALQZEDy8v7az8Ks8/................SVrttqCVOp9X0kDtYXh2EZIHYGYfVUlptlcpTLtfnn7PR6Tbpl8rpjy93lxcYmDftq9ZSCVDQnruZm6unQYfhis/Ife/bWfu0CHxnMc3Qam9VpEPk/vftp91gZ`+N5ilMOg2lbByAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAIAgCAID//2Q=="];
They told about the dataWithBase64EncodedString:
method which is not there in my version of xcode.
Please help.
You can make use of
UIImage *image = [[UIImage alloc] initWithData:data];
or
UIImage *image = [UIImage imageWithData:data];
The data in the data parameter must be formatted to match the file format of one of the system’s supported image types.
Try the following (where data is of the NSData type):
UIImage *img = [[UIImage alloc] initWithData: data];
精彩评论