Skip to content

Instantly share code, notes, and snippets.

@hanksudo
Created February 11, 2011 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanksudo/822187 to your computer and use it in GitHub Desktop.
Save hanksudo/822187 to your computer and use it in GitHub Desktop.
Simple Snippet to implement UIActionSheet
#import <UIKit/UIKit.h>
@interface UntitledViewController : UIViewController <UIActionSheetDelegate> {
}
- (IBAction)showActionSheet:(id)sender;
@end
- (void)showActionSheet:(id)sender {
UIActionSheet *action = [[UIActionSheet alloc]
initWithTitle:@"Hello"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:@"Delete Message"
otherButtonTitles:@"Option 1", @"Option 2", nil];
[action showInView:self.view];
[action release];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"%d", buttonIndex);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment