Update AppIconOptionsController.m

This commit is contained in:
arichornlover 2024-05-01 19:41:09 -05:00 committed by GitHub
parent faa9590ac7
commit c409041e93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,6 +27,14 @@
self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
NSBundle *backIcon = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"]];
UIImage *backImage = [UIImage imageNamed:@"Back.png" inBundle:backIcon compatibleWithTraitCollection:nil];
backImage = [self resizeImage:backImage newSize:CGSizeMake(24, 24)];
if ([self isDarkBackground]) {
backImage = [backImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.backButton setTintColor:[UIColor whiteColor]];
} else {
backImage = [backImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.backButton setTintColor:[UIColor blackColor]];
}
[self.backButton setImage:backImage forState:UIControlStateNormal];
[self.backButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
[self.backButton setFrame:CGRectMake(0, 0, 24, 24)];
@ -151,6 +159,14 @@
return resizedImage;
}
- (UIImage *)resizeImage:(UIImage *)image newSize:(CGSize)newSize {
UIGraphicsBeginImageContextWithOptions(newSize, NO, [UIScreen mainScreen].scale);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];