SHARE
TWEET

UIImage from icon app

priore Jun 5th, 2013 532 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. + (UIImage*)imageFromIconApp {
  2.    
  3.         NSString *iconName = nil;
  4.         NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
  5.    
  6.     NSArray *iconfiles = [info valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"];
  7.     if (iconfiles == nil || [iconfiles count] == 0) iconfiles = [info objectForKey:@"CFBundleIconFiles"];
  8.         if (iconfiles != nil && [iconfiles count] > 0) {
  9.                 iconName = [iconfiles objectAtIndex:0];
  10.         } else {
  11.                 iconName = [info objectForKey:@"CFBundleIconFile"];
  12.         }
  13.         return [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[iconName stringByReplacingOccurrencesOfString:@"@2x" withString:@""] ofType:@"png"]];
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top