File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,14 +64,18 @@ - (void)parseConfig:(NSDictionary *)buttonConfig
6464 {
6565 self.defaultBackgroundColor = buttonConfig[@" backgroundColor" ];
6666 }
67- if (buttonConfig[@" borderColor" ])
67+ if (buttonConfig[@" textColor" ])
68+ {
69+ [self setTitleColor: buttonConfig[@" textColor" ] forState: UIControlStateNormal];
70+ }
71+ if ((buttonConfig[@" borderColor" ]) && (buttonConfig[@" borderWidth" ]))
6872 {
6973 self.layer .borderColor = ((UIColor*)buttonConfig[@" borderColor" ]).CGColor ;
70- self.layer .borderWidth = self. layer . borderWidth ?: 2 . 0f ;
74+ self.layer .borderWidth = [buttonConfig[ @" borderWidth" ] floatValue ] ;
7175 }
72- if (buttonConfig[@" textColor " ])
76+ else if (buttonConfig[@" borderWidth " ])
7377 {
74- [ self setTitleColor: buttonConfig[@" textColor " ] forState: UIControlStateNormal ];
78+ self. layer . borderWidth = [ buttonConfig[@" borderWidth " ] floatValue ];
7579 }
7680}
7781
Original file line number Diff line number Diff line change @@ -40,14 +40,13 @@ - (IBAction)showSuccess:(id)sender
4040
4141 SCLButton *button = [alert addButton: @" First Button" target: self selector: @selector (firstButton )];
4242
43- button.layer .borderWidth = 2 .0f ;
44-
4543 button.buttonFormatBlock = ^NSDictionary * (void )
4644 {
4745 NSMutableDictionary *buttonConfig = [[NSMutableDictionary alloc ] init ];
4846
4947 buttonConfig[@" backgroundColor" ] = [UIColor whiteColor ];
5048 buttonConfig[@" textColor" ] = [UIColor blackColor ];
49+ buttonConfig[@" borderWidth" ] = [NSNumber numberWithFloat: 2 .0f ];
5150 buttonConfig[@" borderColor" ] = [UIColor greenColor ];
5251
5352 return buttonConfig;
@@ -141,6 +140,7 @@ - (IBAction)showAdvanced:(id)sender
141140
142141 buttonConfig[@" backgroundColor" ] = [UIColor greenColor ];
143142 buttonConfig[@" borderColor" ] = [UIColor blackColor ];
143+ buttonConfig[@" borderWidth" ] = @" 1.0f" ;
144144 buttonConfig[@" textColor" ] = [UIColor blackColor ];
145145
146146 return buttonConfig;
You can’t perform that action at this time.
0 commit comments