diff --git a/Example/PSTAlertViewControllerSample/Base.lproj/Main.storyboard b/Example/PSTAlertViewControllerSample/Base.lproj/Main.storyboard index 0933939..2ee933f 100644 --- a/Example/PSTAlertViewControllerSample/Base.lproj/Main.storyboard +++ b/Example/PSTAlertViewControllerSample/Base.lproj/Main.storyboard @@ -30,12 +30,22 @@ + + + diff --git a/Example/PSTAlertViewControllerSample/ViewController.m b/Example/PSTAlertViewControllerSample/ViewController.m index e350e03..9115f99 100644 --- a/Example/PSTAlertViewControllerSample/ViewController.m +++ b/Example/PSTAlertViewControllerSample/ViewController.m @@ -19,11 +19,11 @@ - (IBAction)testButtonPressed:(UIButton *)sender { PSTAlertController *controller = [PSTAlertController actionSheetWithTitle:nil]; [controller addAction:[PSTAlertAction actionWithTitle:@"OK" style:PSTAlertActionStyleDestructive handler:nil]]; // Cancel action on a sheet should be the last action. - [controller addAction:[PSTAlertAction actionWithTitle:@"cancel" style:PSTAlertActionStyleCancel handler:nil]]; + [controller addCancelActionWithHandler:nil]; [controller showWithSender:sender arrowDirection:UIPopoverArrowDirectionAny controller:self animated:YES completion:nil]; } -- (void)doTheDance { +- (IBAction)doTheDance:(UIButton *)sender { PSTAlertController *gotoPageController = [PSTAlertController alertWithTitle:@"Go to page" message:nil]; [gotoPageController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.keyboardType = UIKeyboardTypeNumberPad; @@ -33,13 +33,13 @@ - (void)doTheDance { NSString *pageLabel = action.alertController.textField.text; PSTAlertController *dismissable = [PSTAlertController presentDismissableAlertWithTitle:@"Result" message:[NSString stringWithFormat:@"You entered %@", pageLabel] controller:self]; [dismissable addDidDismissBlock:^(PSTAlertAction *action) { - [self doTheDance]; + [self doTheDance:nil]; }]; }]]; [gotoPageController addAction:[PSTAlertAction actionWithTitle:@"No" style:PSTAlertActionStyleDestructive handler:^(PSTAlertAction *action) { PSTAlertController *sheetController = [PSTAlertController actionSheetWithTitle:@"No?"]; [sheetController addAction:[PSTAlertAction actionWithTitle:@"I've changed my mind" handler:^(PSTAlertAction *action) { - [self doTheDance]; + [self doTheDance:nil]; }]]; // Cancel action on a sheet should be the last action. [sheetController addAction:[PSTAlertAction actionWithTitle:@"That's fine." style:PSTAlertActionStyleCancel handler:NULL]];