iPhone – ActionSheet example in iphone…

This is a simple ActionSheet example.ActionSheet is one of the basic component in the  object library.

Lets start one,
Step 1: Start the program by opening the Xcode. select the option Create a new Xcode Project.

Step 2: Select the option Single view Application.

Step 3: Enter the name of the project , simulator and  click next and save the project.

Step 4: Drag a button from object library and place it on the viewController.xib file.

Step 5: Now place the mouse over the button and right click on it and drag a line on the ViewController.m as shown below.

Step 6: Now a small window appears.here select Action option on the Connection field.Give a name for your button method and click connect.

Step 7: Now inside the method add the code below,

UIActionSheet *action=[[UIActionSheet alloc]initWithTitle:@”I am a ActionSheet” delegate:nil cancelButtonTitle:@”OKAY” destructiveButtonTitle:nil otherButtonTitles:@”Button1″,@”Button2″,nil];  //Create a UIActionSheet button

[action setActionSheetStyle:UIActionSheetStyleBlackOpaque];  // set Style for the Action

[action showInView:self.view];  //Display the ActionSheet in the view.

Step 8: Now Run the Project.


One thought on “iPhone – ActionSheet example in iphone…”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s