Skip to content

Commit 6fc84a5

Browse files
author
André Felipe Santos
committed
Swap switch view custom example button for custom one
1 parent 0db179d commit 6fc84a5

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

SCLAlertViewExample/ViewController.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,22 @@ - (IBAction)showQuestion:(id)sender
263263
}
264264

265265
- (IBAction)showSwitch:(id)sender {
266-
SCLAlertView *alert = [[SCLAlertView alloc] init];
266+
SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindow];
267267
alert.tintTopCircle = NO;
268268
alert.iconTintColor = [UIColor brownColor];
269269
alert.useLargerIcon = YES;
270270

271271
SCLSwitchView *switchView = [alert addSwitchViewWithLabel:@"Don't show again".uppercaseString];
272272
switchView.tintColor = [UIColor brownColor];
273273

274-
[alert addButton:@"Done" actionBlock:^(void) {
275-
NSLog(@"Show again? %@", switchView.isSelected ? @"-No": @"-Yes");
276-
}];
274+
SCLButton *button = [alert addButton:@"Done" target:self selector:@selector(firstButton)];
275+
276+
button.buttonFormatBlock = ^NSDictionary* (void) {
277+
NSMutableDictionary *buttonConfig = [[NSMutableDictionary alloc] init];
278+
buttonConfig[@"cornerRadius"] = @"17.5f";
279+
280+
return buttonConfig;
281+
};
277282

278283
[alert showCustom:self image:[UIImage imageNamed:@"switch"] color:[UIColor brownColor] title:kInfoTitle subTitle:kSubtitle closeButtonTitle:nil duration:0.0f];
279284
}

0 commit comments

Comments
 (0)