2011-04-29 42 views
0

如何创建如下所示的删除确认?如何在xcode中创建“删除”操作表?

+0

查找一个UIActionSheet在文档中。 – Jamie 2011-04-29 06:35:38

+0

我编辑过你的标题,因为单词“popver”指的是别的东西。 (请参阅[UIPopoverController](http://developer.apple.com/library/ios/documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html)类参考。) – Moshe 2011-04-29 07:02:37

+0

对不起。谢谢... – SEG 2011-04-30 05:10:43

回答

0

使用的InterfaceBuilder(或在xCode4等效编辑)来创建视图。写你的视图控制器。然后使用Core Animation从下面为视图添加动画。

2

您需要使用UIActionSheet

您可以创建这样

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 

您需要实现UIActionSheetDelegate方法

- (void)actionSheet:(UIActionSheet *)actionSheet 
      clickedButtonAtIndex:(NSInteger)buttonIndex{ 

    if (buttonIndex == 0){ 
     //do your action 
    }else if(buttonIndex == 1){ 
     // do your other action 
    } 
} 
2

这是一个UIActionSheet的一个实例的ActionSheet。红色按钮称为“破坏性按钮”,黑色按钮称为“取消按钮”。

这里是一个演示:

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];