Skip to content

Commit f6081fd

Browse files
committed
Use default backgroundColor for button config, add buttonFormatBlock.
1 parent 473ded1 commit f6081fd

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

SCLAlertView/SCLAlertView.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,20 @@ typedef NS_ENUM(NSInteger, SCLAlertViewBackground)
108108
*/
109109
@property (nonatomic, copy) SCLAttributedFormatBlock attributedFormatBlock;
110110

111-
/** Set button format block.
111+
/** Set Complete button format block.
112112
*
113113
* Holds the button format block.
114-
* Support keys : backgroundColor, textColor
114+
* Support keys : backgroundColor, borderColor, textColor
115115
*/
116116
@property (nonatomic, copy) CompleteButtonFormatBlock completeButtonFormatBlock;
117117

118+
/** Set button format block.
119+
*
120+
* Holds the button format block.
121+
* Support keys : backgroundColor, borderColor, textColor
122+
*/
123+
@property (nonatomic, copy) ButtonFormatBlock buttonFormatBlock;
124+
118125
/** Hide animation type
119126
*
120127
* Holds the hide animation type.

SCLAlertView/SCLAlertView.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,12 @@ - (SCLButton *)addDoneButtonWithTitle:(NSString *)title
529529
- (SCLButton *)addButton:(NSString *)title actionBlock:(SCLActionBlock)action
530530
{
531531
SCLButton *btn = [self addButton:title];
532+
533+
if (_buttonFormatBlock != nil)
534+
{
535+
btn.buttonFormatBlock = _buttonFormatBlock;
536+
}
537+
532538
btn.actionType = Block;
533539
btn.actionBlock = action;
534540
[btn addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
@@ -774,6 +780,7 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag
774780
{
775781
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
776782
}
783+
btn.defaultBackgroundColor = viewColor;
777784

778785
if (btn.completeButtonFormatBlock != nil)
779786
{
@@ -783,10 +790,6 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag
783790
{
784791
[btn parseConfig:btn.buttonFormatBlock()];
785792
}
786-
else
787-
{
788-
btn.defaultBackgroundColor = viewColor;
789-
}
790793
}
791794

792795
// Adding duration

0 commit comments

Comments
 (0)