Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 24th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Howto load a smaller version of UImage directly from a file in ios?
  2. #define kAppIconHeight 48
  3.  
  4. // Set appIcon and clear temporary data/image
  5. UIImage *image = [[UIImage alloc] initWithData:self.activeDownload];
  6.  
  7. if (image.size.width != kAppIconHeight && image.size.height != kAppIconHeight)
  8. {
  9.     CGSize itemSize = CGSizeMake(kAppIconHeight, kAppIconHeight);
  10.     UIGraphicsBeginImageContext(itemSize);
  11.     CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
  12.     [image drawInRect:imageRect];
  13.     self.appRecord.appIcon = UIGraphicsGetImageFromCurrentImageContext();
  14.     UIGraphicsEndImageContext();
  15. }
  16. else
  17. {
  18.     self.appRecord.appIcon = image;
  19. }
  20.  
  21. self.activeDownload = nil;
  22. [image release];