Skip to content

Instantly share code, notes, and snippets.

@tgautier-silicon
Created February 28, 2012 14:08
Show Gist options
  • Save tgautier-silicon/1932736 to your computer and use it in GitHub Desktop.
Save tgautier-silicon/1932736 to your computer and use it in GitHub Desktop.
- (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