O'Reilly logo

Xcode 4 iOS Development by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required