From 54a4cf27b947b46de9854d91fb141076771ac217 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 21 Oct 2011 00:12:10 +0000 Subject: [PATCH] Replace UIAlertSheet with UIAlertView. --- Settings.mm | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/Settings.mm b/Settings.mm index 89231a0..442e97c 100644 --- a/Settings.mm +++ b/Settings.mm @@ -371,18 +371,17 @@ static NSString *_plist; } - (void) optimizeThemes { - UIActionSheet *sheet([[[UIActionSheet alloc] + UIAlertView *alert([[[UIAlertView alloc] initWithTitle:@"Optimize Themes" - buttons:[NSArray arrayWithObjects:@"Optimize", @"Cancel", nil] - defaultButtonIndex:1 + message:@"Please note that this setting /replaces/ the PNG files that came with the theme. PNG files that have been iPhone-optimized cannot be viewed on a normal computer unless they are first deoptimized. You can use Cydia to reinstall themes that have been optimized in order to revert to the original PNG files." delegate:self - context:@"optimize" + cancelButtonTitle:@"Cancel" + otherButtonTitles:@"Optimize", nil ] autorelease]); - [sheet setBodyText:@"Please note that this setting /replaces/ the PNG files that came with the theme. PNG files that have been iPhone-optimized cannot be viewed on a normal computer unless they are first deoptimized. You can use Cydia to reinstall themes that have been optimized in order to revert to the original PNG files."]; - [sheet setNumberOfRows:1]; - [sheet setDestructiveButtonIndex:0]; - [sheet popupAlertAnimated:YES]; + [alert setContext:@"optimize"]; + [alert setNumberOfRows:1]; + [alert show]; } - (void) _optimizeThemes { @@ -404,20 +403,18 @@ static NSString *_plist; [self settingsChanged]; } -- (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button { - NSString *context([sheet context]); +- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button { + NSString *context([alert context]); if ([context isEqualToString:@"optimize"]) { - switch (button) { - case 1: - [self performSelector:@selector(_optimizeThemes) withObject:nil afterDelay:0]; - break; + if (button == [alert firstOtherButtonIndex]) { + [self performSelector:@selector(_optimizeThemes) withObject:nil afterDelay:0]; } - [sheet dismiss]; - } else - [super alertSheet:sheet buttonClicked:button]; - + [alert dismissWithClickedButtonIndex:-1 animated:YES]; + } + /*else if ([super respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) + [super alertView:alert clickedButtonAtIndex:button];*/ } @end -- 2.45.2