mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-19 05:42:10 +00:00
Update AppIconOptionsController.m
This commit is contained in:
parent
26b8ca0a95
commit
9de3ac645e
1 changed files with 17 additions and 1 deletions
|
|
@ -89,7 +89,7 @@
|
|||
- (UIImage *)appIconPreviewForIconName:(NSString *)iconName {
|
||||
NSDictionary *iconData = self.alternateIcons[iconName];
|
||||
NSArray *iconFiles = iconData[@"CFBundleIconFiles"];
|
||||
NSString iconFile = iconFiles[0];
|
||||
NSString *iconFile = iconFiles[0];
|
||||
|
||||
UIImage *iconImage = [UIImage imageNamed:iconFile];
|
||||
UIImage *roundedIconImage = [self createRoundedImage:iconImage size:CGSizeMake(120, 120)];
|
||||
|
|
@ -97,6 +97,22 @@
|
|||
return roundedIconImage;
|
||||
}
|
||||
|
||||
- (UIImage *)createRoundedImage:(UIImage *)image size:(CGSize)size {
|
||||
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:size];
|
||||
return [renderer imageWithActions:^(UIGraphicsImageRendererContext *context) {
|
||||
UIBezierPath *roundPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, size.width, size.height) cornerRadius:size.width / 2.0];
|
||||
[roundPath addClip];
|
||||
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
||||
}];
|
||||
}
|
||||
|
||||
- (UIImage *)resizeImage:(UIImage *)image newSize:(CGSize)newSize {
|
||||
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:newSize];
|
||||
return [renderer imageWithActions:^(UIGraphicsImageRendererContext *context) {
|
||||
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
|
|
|||
Loading…
Reference in a new issue