diff --git a/SIAlertView/SIAlertView.bundle/button-valid-hi.png b/SIAlertView/SIAlertView.bundle/button-valid-hi.png new file mode 100644 index 0000000..5c25dfe Binary files /dev/null and b/SIAlertView/SIAlertView.bundle/button-valid-hi.png differ diff --git a/SIAlertView/SIAlertView.bundle/button-valid-hi@2x.png b/SIAlertView/SIAlertView.bundle/button-valid-hi@2x.png new file mode 100644 index 0000000..17f6704 Binary files /dev/null and b/SIAlertView/SIAlertView.bundle/button-valid-hi@2x.png differ diff --git a/SIAlertView/SIAlertView.bundle/button-valid-normal.png b/SIAlertView/SIAlertView.bundle/button-valid-normal.png new file mode 100644 index 0000000..bc05773 Binary files /dev/null and b/SIAlertView/SIAlertView.bundle/button-valid-normal.png differ diff --git a/SIAlertView/SIAlertView.bundle/button-valid-normal@2x.png b/SIAlertView/SIAlertView.bundle/button-valid-normal@2x.png new file mode 100644 index 0000000..d402621 Binary files /dev/null and b/SIAlertView/SIAlertView.bundle/button-valid-normal@2x.png differ diff --git a/SIAlertView/SIAlertView.h b/SIAlertView/SIAlertView.h index e4d620a..02fda5e 100644 --- a/SIAlertView/SIAlertView.h +++ b/SIAlertView/SIAlertView.h @@ -16,7 +16,8 @@ extern NSString *const SIAlertViewDidDismissNotification; typedef NS_ENUM(NSInteger, SIAlertViewButtonType) { SIAlertViewButtonTypeDefault = 0, SIAlertViewButtonTypeDestructive, - SIAlertViewButtonTypeCancel + SIAlertViewButtonTypeCancel, + SIAlertViewButtonTypeValid }; typedef NS_ENUM(NSInteger, SIAlertViewBackgroundStyle) { @@ -67,6 +68,7 @@ typedef void(^SIAlertViewHandler)(SIAlertView *alertView); @property (nonatomic, strong) UIColor *buttonColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property (nonatomic, strong) UIColor *cancelButtonColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property (nonatomic, strong) UIColor *destructiveButtonColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; +@property (nonatomic, strong) UIColor *validButtonColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property (nonatomic, assign) CGFloat cornerRadius NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 2.0 @property (nonatomic, assign) CGFloat shadowRadius NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 8.0 diff --git a/SIAlertView/SIAlertView.m b/SIAlertView/SIAlertView.m index 7a67df3..eef20af 100644 --- a/SIAlertView/SIAlertView.m +++ b/SIAlertView/SIAlertView.m @@ -245,6 +245,7 @@ + (void)initialize appearance.buttonColor = [UIColor colorWithWhite:0.4 alpha:1]; appearance.cancelButtonColor = [UIColor colorWithWhite:0.3 alpha:1]; appearance.destructiveButtonColor = [UIColor whiteColor]; + appearance.validButtonColor = [UIColor whiteColor]; appearance.cornerRadius = 2; appearance.shadowRadius = 8; } @@ -988,6 +989,12 @@ - (UIButton *)buttonForItemIndex:(NSUInteger)index [button setTitleColor:self.destructiveButtonColor forState:UIControlStateNormal]; [button setTitleColor:[self.destructiveButtonColor colorWithAlphaComponent:0.8] forState:UIControlStateHighlighted]; break; + case SIAlertViewButtonTypeValid: + normalImage = [UIImage imageNamed:@"SIAlertView.bundle/button-valid-normal"]; + highlightedImage = [UIImage imageNamed:@"SIAlertView.bundle/button-valid-hi"]; + [button setTitleColor:self.validButtonColor forState:UIControlStateNormal]; + [button setTitleColor:[self.validButtonColor colorWithAlphaComponent:0.8] forState:UIControlStateHighlighted]; + break; case SIAlertViewButtonTypeDefault: default: normalImage = [UIImage imageNamed:@"SIAlertView.bundle/button-default"]; diff --git a/SIAlertViewExample/SIAlertViewExample.xcodeproj/project.xcworkspace/xcshareddata/SIAlertViewExample.xccheckout b/SIAlertViewExample/SIAlertViewExample.xcodeproj/project.xcworkspace/xcshareddata/SIAlertViewExample.xccheckout index 37fdd7b..1ce9dcc 100644 --- a/SIAlertViewExample/SIAlertViewExample.xcodeproj/project.xcworkspace/xcshareddata/SIAlertViewExample.xccheckout +++ b/SIAlertViewExample/SIAlertViewExample.xcodeproj/project.xcworkspace/xcshareddata/SIAlertViewExample.xccheckout @@ -10,29 +10,29 @@ SIAlertViewExample IDESourceControlProjectOriginsDictionary - 1EE19127-7F15-4095-A45D-7D481FB08953 + E2E339EC05FF99AF5ECAE62EDBC78398DA1111C6 https://github.com/Sumi-Interactive/SIAlertView.git IDESourceControlProjectPath SIAlertViewExample/SIAlertViewExample.xcodeproj/project.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary - 1EE19127-7F15-4095-A45D-7D481FB08953 + E2E339EC05FF99AF5ECAE62EDBC78398DA1111C6 ../../.. IDESourceControlProjectURL https://github.com/Sumi-Interactive/SIAlertView.git IDESourceControlProjectVersion - 110 + 111 IDESourceControlProjectWCCIdentifier - 1EE19127-7F15-4095-A45D-7D481FB08953 + E2E339EC05FF99AF5ECAE62EDBC78398DA1111C6 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 1EE19127-7F15-4095-A45D-7D481FB08953 + E2E339EC05FF99AF5ECAE62EDBC78398DA1111C6 IDESourceControlWCCName SIAlertView diff --git a/SIAlertViewExample/SIAlertViewExample/ViewController.m b/SIAlertViewExample/SIAlertViewExample/ViewController.m index ec2687e..31e1ef6 100644 --- a/SIAlertViewExample/SIAlertViewExample/ViewController.m +++ b/SIAlertViewExample/SIAlertViewExample/ViewController.m @@ -61,6 +61,11 @@ - (IBAction)alert1:(id)sender handler:^(SIAlertView *alertView) { NSLog(@"Button3 Clicked"); }]; + [alertView addButtonWithTitle:@"Button4" + type:SIAlertViewButtonTypeValid + handler:^(SIAlertView *alertView) { + NSLog(@"Button4 Clicked"); + }]; alertView.willShowHandler = ^(SIAlertView *alertView) { NSLog(@"%@, willShowHandler", alertView);