Created
May 3, 2012 21:05
-
-
Save christineyen/2589505 to your computer and use it in GitHub Desktop.
Framework vs. BlocksKit handling, for blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)clickedCloseButton:(id)sender { | |
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Discard post?" | |
delegate:self | |
cancelButtonTitle:@"Cancel" | |
destructiveButtonTitle:@"Discard" | |
otherButtonTitles:@"Save draft", nil]; | |
[actionSheet showInView:self.view]; | |
} | |
// UIActionSheetDelegate methods | |
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { | |
if (buttonIndex == 0) { | |
// save as draft | |
} else if (buttonIndex == 1) { | |
// discard | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)clickedCloseButton:(id)sender { | |
UIActionSheet *confirmSheet = [UIActionSheet actionSheetWithTitle:@"Discard post?"]; | |
[confirmSheet addButtonWithTitle:@"Save draft" handler:^{ | |
// save as draft | |
}]; | |
[confirmSheet setDestructiveButtonWithTitle:@"Discard" handler:^{ | |
// discard | |
}]; | |
[confirmSheet setCancelButtonWithTitle:@"Cancel" handler:NULL]; | |
[confirmSheet showInView:self.view]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment