priore

UIImage from icon app

Jun 5th, 2013
688
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×