Created
February 11, 2011 10:31
-
-
Save hanksudo/822187 to your computer and use it in GitHub Desktop.
Simple Snippet to implement UIActionSheet
This file contains hidden or 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
#import <UIKit/UIKit.h> | |
@interface UntitledViewController : UIViewController <UIActionSheetDelegate> { | |
} | |
- (IBAction)showActionSheet:(id)sender; | |
@end |
This file contains hidden or 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
- (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