Closed tropicdome closed 7 years ago
hi @tropicdome , you can configure your button specs
SCLButton *button = [alert addButton:@"First Button" target:self selector:@selector(firstButton)];
button.buttonFormatBlock = ^NSDictionary* (void)
{
NSMutableDictionary *buttonConfig = [[NSMutableDictionary alloc] init];
buttonConfig[@"backgroundColor"] = [UIColor redColor];
buttonConfig[@"textColor"] = [UIColor blackColor];
buttonConfig[@"borderWidth"] = @2.0f;
buttonConfig[@"borderColor"] = [UIColor greenColor];
return buttonConfig;
};
Another approach
SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindow];
[alert addButton:@"First Button" target:self selector:@selector(firstButton)];
__block SCLAlertView *blockAlert = alert;
SCLButton *button = [alert addButton:@"Close" actionBlock:^(void) {
[blockAlert hideView];
}];
button.buttonFormatBlock = ^NSDictionary* (void)
{
NSMutableDictionary *buttonConfig = [[NSMutableDictionary alloc] init];
buttonConfig[@"backgroundColor"] = [UIColor redColor];
buttonConfig[@"textColor"] = [UIColor blackColor];
return buttonConfig;
};
[alert showSuccess:kSuccessTitle subTitle:kSubtitle closeButtonTitle:nil duration:0.0f];
I will try that. Thank you
From a user experience point of view it would be great to be able to change the color of the different buttons, especially the close/cancel button. It can be unintuitive for a user if the close button is the same color as the other button(s).