Return to Snippet

Revision: 26237
at April 21, 2010 09:21 by BenClayton


Initial Code
// place this code in a UIViewController subclass

- (void)debugButtonPressed:(id)sender
{
	UIActionSheet* action = [[UIActionSheet alloc] 
							 initWithTitle:@"Menu" 
							 delegate:self 
							 cancelButtonTitle:@"Continue"
							 destructiveButtonTitle:@"Quit" 
							 otherButtonTitles:@"Debug",nil ];
	[action showInView:self.view];
	[action release];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
	switch (buttonIndex) {
		case 0: // continue
			NSLog(@"Continue");
			break;
		case 1: // Quit
			NSLog(@"Quit");
			break;
		case 2: // Debug
			NSLog(@"Debug");
			break;
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
iphone UIActionSheet - pop up list of options

Initial Tags

                                

Initial Language
Objective C