views:

97

answers:

2

How can I convert a string in hex format to retrieve from it an NSData and after that an UIImage inside of my iPhone app?

I've got a string (str) that contains a value like X'FFD8FFE000104A46....01010000010001000'.

That string is created from a xml file by the method:

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
     str = [str stringByAppendingString:string];
}

How can I get the image back from that string?

Thanks in advance,

Andrea

A: 

For converting NSData to a NSString, try "initWithData:encoding:"

For converting NSData to an UIImage, try "imageWithData:"

A: 

You may find GTMStringEncoding helpful, from Google Toolbox For Mac.

David M.