From 473ded149d264fc78ffd45336b912d58eef81f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Wrzosek?= Date: Wed, 18 Feb 2015 12:29:43 +0100 Subject: [PATCH 1/3] Allow to change buttons configuration for Warning style. --- SCLAlertView/SCLAlertView.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 8439a1d..885d43c 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -770,6 +770,11 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag for (SCLButton *btn in _buttons) { + if (style == Warning) + { + [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + } + if (btn.completeButtonFormatBlock != nil) { [btn parseConfig:btn.completeButtonFormatBlock()]; @@ -782,10 +787,6 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag { btn.defaultBackgroundColor = viewColor; } - if (style == Warning) - { - [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; - } } // Adding duration From f6081fdfc729c7d54416e29afcd06d7d756cd03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Wrzosek?= Date: Wed, 18 Feb 2015 13:29:54 +0100 Subject: [PATCH 2/3] Use default backgroundColor for button config, add buttonFormatBlock. --- SCLAlertView/SCLAlertView.h | 11 +++++++++-- SCLAlertView/SCLAlertView.m | 11 +++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index b1117ab..41feb8d 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -108,13 +108,20 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) */ @property (nonatomic, copy) SCLAttributedFormatBlock attributedFormatBlock; -/** Set button format block. +/** Set Complete button format block. * * Holds the button format block. - * Support keys : backgroundColor, textColor + * Support keys : backgroundColor, borderColor, textColor */ @property (nonatomic, copy) CompleteButtonFormatBlock completeButtonFormatBlock; +/** Set button format block. + * + * Holds the button format block. + * Support keys : backgroundColor, borderColor, textColor + */ +@property (nonatomic, copy) ButtonFormatBlock buttonFormatBlock; + /** Hide animation type * * Holds the hide animation type. diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 885d43c..50f1f57 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -529,6 +529,12 @@ - (SCLButton *)addDoneButtonWithTitle:(NSString *)title - (SCLButton *)addButton:(NSString *)title actionBlock:(SCLActionBlock)action { SCLButton *btn = [self addButton:title]; + + if (_buttonFormatBlock != nil) + { + btn.buttonFormatBlock = _buttonFormatBlock; + } + btn.actionType = Block; btn.actionBlock = action; [btn addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; @@ -774,6 +780,7 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag { [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; } + btn.defaultBackgroundColor = viewColor; if (btn.completeButtonFormatBlock != nil) { @@ -783,10 +790,6 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag { [btn parseConfig:btn.buttonFormatBlock()]; } - else - { - btn.defaultBackgroundColor = viewColor; - } } // Adding duration From de634376dc10911b8be83b46fceda072673f8c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Wrzosek?= Date: Wed, 18 Feb 2015 14:22:35 +0100 Subject: [PATCH 3/3] Add option to set custom tint color for icon image. --- SCLAlertView/SCLAlertView.h | 6 ++++++ SCLAlertView/SCLAlertView.m | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SCLAlertView/SCLAlertView.h b/SCLAlertView/SCLAlertView.h index 41feb8d..3bb799e 100755 --- a/SCLAlertView/SCLAlertView.h +++ b/SCLAlertView/SCLAlertView.h @@ -156,6 +156,12 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground) */ @property (nonatomic, strong) UIColor *backgroundViewColor; +/** Set custom tint color for icon image. + * + * SCLAlertView icon tint color + */ +@property (nonatomic, strong) UIColor *iconTintColor; + /** Warns that alerts is gone * * Warns that alerts is gone using block diff --git a/SCLAlertView/SCLAlertView.m b/SCLAlertView/SCLAlertView.m index 50f1f57..8cbe962 100755 --- a/SCLAlertView/SCLAlertView.m +++ b/SCLAlertView/SCLAlertView.m @@ -766,7 +766,11 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag } else { - self.circleIconImageView.image = iconImage; + if (self.iconTintColor) { + self.circleIconImageView.tintColor = self.iconTintColor; + iconImage = [iconImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + } + self.circleIconImageView.image = iconImage; } for (UITextField *textField in _inputs)