Skip to content

Instantly share code, notes, and snippets.

@drouillard
Last active August 29, 2015 14:13
Show Gist options
  • Save drouillard/fc43316a5030d54dfe55 to your computer and use it in GitHub Desktop.
Save drouillard/fc43316a5030d54dfe55 to your computer and use it in GitHub Desktop.
UI Action Sheet with blocks that implements a correctly looking 'No' button. Meaning not at top of ActionSheet.
//Uses UIActionSheet+blocks
UIActionSheet *as = [[UIActionSheet alloc] initWithTitle:@"Save before leaving?"
delegate:nil
cancelButtonTitle:NSLocalizedString(@"CancelBtnText", nil)
destructiveButtonTitle:nil
otherButtonTitles:@"Yes",@"No",nil ];
as.destructiveButtonIndex = 1;
as.tapBlock = ^(UIActionSheet *actionSheet, NSInteger buttonIndex){
NSLog(@"Chose %@", [actionSheet buttonTitleAtIndex:buttonIndex]);
};
[as showInView:self.view];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment