Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Tom Coomer
1,331 PointsXcode action sheets
How would I launch an action sheet on the click of a button in xcode
1 Answer

Fabio Floris
526 Points - (IBAction)Action:(id)sender {
UIActionSheet *FF_ActionSheetSelectFoto = [[UIActionSheet alloc] initWithTitle:@"Message!"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Button Bla Bla",@"Button Bla Bla 2", nil];
FF_ActionSheetSelectFoto.actionSheetStyle = UIActionSheetStyleDefault;
[FF_ActionSheetSelectFoto showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
// action button 1
}
else if (buttonIndex == 0) {
//The 0 button in this case is equivalent to the key called in other buttons
// Actions button 0
}
}
Remember delegate <UIActionSheetDelegate>