title: How to show image from the Hex string [iphone]?
body: <p><code>I have such Hex code  89504e470d0a1a0a0000000d49484452000001000000010008060000005c72a8</code></p>
  
  <p>now this hex code is the code of some image . that I know , now I want to show that image in a imageView . I dont know how to do it because when I am converting this Hex into NSData and trying yo convert  that data into image view and when I show that Image . the image is not being shown. </p>
  
  <p>can anybody tell me how to do this?</p>
  
  <p>// This is the first part i.e. image to hex conversion</p>
  
  <pre><code>UIImage *img = [UIImage imageNamed:@"image.png"];
  NSData *data1 = UIImagePNGRepresentation(img);
  </code></pre>
  
  <p>//  NSLog(@"data is %@",data1);</p>
  
  <pre><code>const unsigned *tokenBytes = [data1 bytes];
  NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
                        ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
                        ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
                        ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
  
  NSLog(@"hexToken is %@",hexToken);
  </code></pre>