Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Enable the beautiful dance in example project
Browse files Browse the repository at this point in the history
  • Loading branch information
joelekstrom committed Sep 15, 2015
1 parent fe022b0 commit 2eaca2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions Example/PSTAlertViewControllerSample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,22 @@
<action selector="testButtonPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="1TS-0W-adq"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3ry-HB-NNt">
<rect key="frame" x="338" y="268" width="92" height="30"/>
<animations/>
<state key="normal" title="Do the dance"/>
<connections>
<action selector="doTheDance:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Kff-0Z-fYE"/>
</connections>
</button>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="NAa-Py-WRi" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="2aS-cz-kb3"/>
<constraint firstItem="NAa-Py-WRi" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="90" id="4pj-XW-nCu"/>
<constraint firstItem="3ry-HB-NNt" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="kX0-4W-9Dc"/>
<constraint firstItem="3ry-HB-NNt" firstAttribute="top" secondItem="NAa-Py-WRi" secondAttribute="bottom" constant="128" id="v41-x0-RFK"/>
</constraints>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="iPad"/>
Expand Down
8 changes: 4 additions & 4 deletions Example/PSTAlertViewControllerSample/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]];
Expand Down

0 comments on commit 2eaca2f

Please sign in to comment.