Created
February 28, 2012 14:08
-
-
Save tgautier-silicon/1932736 to your computer and use it in GitHub Desktop.
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)buttonPressed:(id)sender { | |
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure?" | |
delegate:self | |
cancelButtonTitle:@"No Way!" | |
destructiveButtonTitle:@"Yes, I'm sure!" | |
otherButtonTitles: nil]; | |
[actionSheet showInView:self.view]; | |
} | |
- (void)actionSheet:(UIActionSheet *)actionSheet | |
didDismissWithButtonIndex:(NSInteger)buttonIndex | |
{ | |
if (buttonIndex != [actionSheet cancelButtonIndex]) { | |
NSString *msg = nil; | |
if (nameField.text.length > 0) | |
msg = [[NSString alloc] initWithFormat: | |
@"You can breathe easy %@, everything went OK.", nameField.text]; | |
else | |
msg = @"You can breathe easy %@, everything went OK."; | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something was done" | |
message:msg | |
delegate:self | |
cancelButtonTitle:@"Phew" | |
otherButtonTitles:nil]; | |
[alert show]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment