Introduction
In this article I will create a Single View application. I will implement an action sheet. For this we write code in the ViewController.m Objective-C class.
To understand it we use the following.
Step 1
Open XCode by double-clicking on it.
Step 2
Create a New XCode Project by clicking on it.
Step 3
Now Select Single View Application and click on Next.
Step 4
Now provide your Product Name and Company Identifier.
Step 5
Select the location where you want to save your project and click on Create.
Step 6
Now here we write the code.
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"This is an Action Sheet" delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete it"
otherButtonTitles:@"Pause", @"Complete", @"Manual End Time", nil];
[actionSheet showInView:self.view]; [actionSheet release];}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Step 7
Finally we click on the run button to show the output.
Step 8
Output in iPhone: