iphone UIActionSheet - pop up list of options


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // place this code in a UIViewController subclass
  2.  
  3. - (void)debugButtonPressed:(id)sender
  4. {
  5. UIActionSheet* action = [[UIActionSheet alloc]
  6. initWithTitle:@"Menu"
  7. delegate:self
  8. cancelButtonTitle:@"Continue"
  9. destructiveButtonTitle:@"Quit"
  10. otherButtonTitles:@"Debug",nil ];
  11. [action showInView:self.view];
  12. [action release];
  13. }
  14.  
  15. - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
  16. switch (buttonIndex) {
  17. case 0: // continue
  18. NSLog(@"Continue");
  19. break;
  20. case 1: // Quit
  21. NSLog(@"Quit");
  22. break;
  23. case 2: // Debug
  24. NSLog(@"Debug");
  25. break;
  26. }
  27. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.