如何创建“删除”列表xcode 中的操作表?

发布于 2024-11-03 20:47:52 字数 81 浏览 0 评论 0原文

如何创建如下所示的删除确认?

How do I create a delete confirmation like the one shown below?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

并安 2024-11-10 20:47:53

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

这是一个演示:

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

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];
喵星人汪星人 2024-11-10 20:47:53

您需要使用 UIActionSheet

您可以像这样创建一个 ActionSheet

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
    }
}

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
    }
}
酷遇一生 2024-11-10 20:47:53

如果您想要如图所示的内容以及其他按钮,请使用下面的 UIActionSheet 博客教程 如果您只想要独立按钮,请按照下面的帖子

如何使用 iPhone SDK 创建一个大的红色 UIButton?

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

How can I create a big, red UIButton with the iPhone SDK?

┊风居住的梦幻卍 2024-11-10 20:47:53

使用 InterfaceBuilder(或 xCode4 中的等效编辑器)创建视图。编写你的视图控制器。然后使用核心动画将视图设置为从下方滑入的动画。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文