Advertisement
Guest User

Untitled

a guest
Oct 29th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @interface SBApplicationIcon - (id)applicationBundleID; @end
  2.  
  3. %hook SBApplicationIcon
  4. - (id)generateIconImage:(int)fp8 {
  5.   NSLog(@"%@",[NSString stringWithFormat:@"/Library/Themes/Lotus Apps.theme/IconBundles/%@@2x.png",[self applicationBundleID]]);
  6.   if([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"/Library/Themes/Lotus Apps.theme/IconBundles/%@@2x.png",[self applicationBundleID]]
  7. isDirectory:nil]) {
  8.     // Round the image and make it the correct size
  9.     UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"/Library/Themes/Lotus Apps.theme/IconBundles/%@@2x.png",[self applicationBundleID]]];
  10.     CALayer *imageLayer = [CALayer layer];
  11.     imageLayer.frame = CGRectMake(0,0,image.size.width - 3,image.size.height - 3);
  12.     imageLayer.contents = (id)image.CGImage;
  13.     imageLayer.masksToBounds = YES;
  14.     imageLayer.cornerRadius = 12;
  15.     UIGraphicsBeginImageContextWithOptions(image.size, NO, [UIScreen mainScreen].scale);
  16.     [imageLayer renderInContext:UIGraphicsGetCurrentContext()];
  17.     UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext();
  18.     UIGraphicsEndImageContext();
  19.     return roundedImage;
  20.   } else return %orig;
  21. }
  22. %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement