Time for action – implementing the Display Action Sheet method

Action sheets provide the user with a variety of options to choose from. For instance, if a user was sending an SMS and there was a problem with it being sent, an action sheet will pop up asking the user if they want to Try again or Dismiss:

  1. Open the GetUsersAttentionViewController.m implementation file.
  2. In the action event which you created for the Display Action Sheet button, add the following code:
    // Displays our Action Sheet - (IBAction)displayActionSheet:(id)sender { // Define an instance of our Action Sheet UIActionSheet *actionSheet; // Initialise our Action Sheet with options actionSheet=[[UIActionSheet alloc]initWithTitle:@"Available Actions" delegate:self cancelButtonTitle:@"Cancel" ...

Get Xcode 4 iOS Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.