How do I create a delete confirmation like the one shown below?
Asked
Active
Viewed 1,521 times
0
-
Look up a UIActionSheet in the docs. – Jamie Apr 29 '11 at 06:35
-
I've edited your title because the word "popver" refers to something else. (See the [UIPopoverController](http://developer.apple.com/library/ios/documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html) class reference.) – Moshe Apr 29 '11 at 07:02
4 Answers
2
You need to use UIActionSheet.
You can create an ActionSheet like this
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@”YOUR_ACTION_SHEET_TITLE”
delegate:self
cancelButtonTitle:@”Cancel”
destructiveButtonTitle:@”Erase Iphone”
otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];//If you are not using ARC
You need to implement UIActionSheetDelegate
method
- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0){
//do your action
}else if(buttonIndex == 1){
// do your other action
}
}

Krishnabhadra
- 34,169
- 30
- 118
- 167
2
That is an instance of a UIActionSheet. The red button is called the "destructive button" and the black button, the "cancel button".
Here is a demo:
UIActionSheet *actSheet = [[UIActionSheet alloc] initWithTitle:@"The text to show on top. (Like the message about wiping the phone.)"delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete everything" otherButtonTitles:nil];
[actSheet ShowFromToolbar:self.toolbar];
[actSheet release];

Moshe
- 57,511
- 78
- 272
- 425
1
If you want the same as shown in photo along with other button use the below UIActionSheet blog tutorial and if you want just standalone button follow the below SO post

Community
- 1
- 1

Jhaliya - Praveen Sharma
- 31,697
- 9
- 72
- 76
0
Use InterfaceBuilder (or the equivalent editors in xCode4) to create the view. Write your view controller. Then animate the view to slide in from below using Core Animation.

Jason
- 11,744
- 3
- 42
- 46