如何在 iPhone 上创建多按钮确认?

发布于 2024-08-19 14:04:07 字数 213 浏览 3 评论 0原文

在 iPhone 上的日历应用程序中,当您按下“删除事件”按钮时,会从底部滑入确认信息。有谁知道这方面的任何示例代码,或者它只是一个带有自定义背景的模态呈现的简短视图?

如果这是使用自定义视图制作的,您知道我可以在哪里获得与日历应用程序中使用的背景图形相同的背景图形吗?

提前致谢!

注意:我不是在谈论 UIAlertView 对话框,而是使用多个按钮的滑入确认。

On the iPhone, in the Calendar App when you press the "Delete Event" button a confirmation slides in from the bottom. Does anyone know of any example code for this, or is it just a short view presented modally with a custom background?

If this is made using a custom view, do you know where I can get a background graphic the same as the one used in the Calendar App?

Thanks in advance!

NB: I am not talking about a UIAlertView dialog box, but the slide-in confirmation with multiple buttons.

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

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

发布评论

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

评论(2

烟燃烟灭 2024-08-26 14:04:07

UIActionSheet 就是您正在寻找的。

以下是一些可帮助您入门的代码示例:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Save photo?" delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
 [actionSheet showInView:self.view];
 [actionSheet release];

这将从底部滑入操作表。它有 2 个按钮。是和否。

当用户选择任何按钮时,actionSheet:didDismissWithButtonIndex: 方法将被调用。

-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
//your code here
}

您的控制器类必须订阅 actionSheet:didDismissWithButtonIndex: 方法。 UIActionSheetDelegate >协议

希望这有帮助!

UIActionSheet is what you are looking for.

Here is some code example to get you started with:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Save photo?" delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
 [actionSheet showInView:self.view];
 [actionSheet release];

This will slide in an action sheet from the bottom. It has 2 buttons. Yes and No.

When a user selects any button the actionSheet:didDismissWithButtonIndex: method gets called

-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
//your code here
}

Your controller class will have to subscribe to the < UIActionSheetDelegate > protocol

Hope this helps!

゛时过境迁 2024-08-26 14:04:07
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancel"  destructiveButtonTitle:@"destructive" otherButtonTitles:@"other", nil];
[actionSheet showInView:self.view];
[actionSheet release];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancel"  destructiveButtonTitle:@"destructive" otherButtonTitles:@"other", nil];
[actionSheet showInView:self.view];
[actionSheet release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文