Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SIAlertView/SIAlertView.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ 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 *buttonBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *cancelButtonBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *destructiveButtonBackgroundColor 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

Expand Down
36 changes: 36 additions & 0 deletions SIAlertView/SIAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,32 @@ - (void)setDestructiveButtonColor:(UIColor *)buttonColor
[self setColor:buttonColor toButtonsOfType:SIAlertViewButtonTypeDestructive];
}

- (void)setButtonBackgroundColor:(UIColor *)backgroundColor
{
if (_buttonBackgroundColor == backgroundColor) {
return;
}
_buttonBackgroundColor = backgroundColor;
[self setBackgroundColor:backgroundColor toButtonsOfType:SIAlertViewButtonTypeDefault];
}

- (void)setCancelButtonBackgroundColor:(UIColor *)backgroundColor
{
if (_cancelButtonBackgroundColor == backgroundColor) {
return;
}
_cancelButtonBackgroundColor = backgroundColor;
[self setBackgroundColor:backgroundColor toButtonsOfType:SIAlertViewButtonTypeCancel];
}

- (void)setDestructiveButtonBackgroundColor:(UIColor *)backgroundColor
{
if (_destructiveButtonBackgroundColor == backgroundColor) {
return;
}
_destructiveButtonBackgroundColor = backgroundColor;
[self setBackgroundColor:backgroundColor toButtonsOfType:SIAlertViewButtonTypeDestructive];
}

- (void)setDefaultButtonImage:(UIImage *)defaultButtonImage forState:(UIControlState)state
{
Expand Down Expand Up @@ -1179,6 +1205,16 @@ -(void)setColor:(UIColor *)color toButtonsOfType:(SIAlertViewButtonType)type {
}
}

-(void)setBackgroundColor:(UIColor *)color toButtonsOfType:(SIAlertViewButtonType)type {
for (NSUInteger i = 0; i < self.items.count; i++) {
SIAlertItem *item = self.items[i];
if(item.type == type) {
UIButton *button = self.buttons[i];
button.backgroundColor = color;
}
}
}

# pragma mark -
# pragma mark Enable parallax effect (iOS7 only)

Expand Down