From e389ecb6d6fa54a6a7710069fc2dde58bd0a34cf Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Sun, 9 Jun 2024 18:49:20 -0500 Subject: [PATCH] Utilize Bundle --- Sources/AppIconOptionsController.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/AppIconOptionsController.m b/Sources/AppIconOptionsController.m index 0bb857a..1de53ed 100644 --- a/Sources/AppIconOptionsController.m +++ b/Sources/AppIconOptionsController.m @@ -114,11 +114,19 @@ } NSString *iconName = self.appIcons[self.selectedIconIndex]; - - UIImage *iconImage = [UIImage imageNamed:iconName]; + + NSString *path = [[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"]; + NSBundle *bundle = [NSBundle bundleWithPath:path]; + NSString *imagePath = [bundle pathForResource:iconName ofType:@"png"]; + UIImage *iconImage = [UIImage imageWithContentsOfFile:imagePath]; + + if (!iconImage) { + NSLog(@"Failed to load custom icon image"); + return; + } + UIImage *roundedIconImage = [self createRoundedImage:iconImage size:CGSizeMake(120, 120)]; // Adjust size as needed - - // Save the image to the main app bundle + NSData *imageData = UIImagePNGRepresentation(roundedIconImage); NSString *newIconPath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@_custom", iconName] ofType:@"png"]; [imageData writeToFile:newIconPath atomically:YES];