Utilize Bundle

This commit is contained in:
arichornlover 2024-06-09 18:49:20 -05:00 committed by GitHub
parent 8d8a2b2135
commit e389ecb6d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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];