ios - 如何创建警报,在 iOS 上使用按钮从底部滑动?

标签 ios user-interface

如何在 iOS 上创建类似 Instagram 取消关注提醒(两个按钮、图像和消息)的提醒?是否有任何现成的组件或我应该从头开始开发它? 这是一个屏幕截图:

enter image description here

最佳答案

有一个实现(UIAlertController),但没有图像。

这是一个工作示例:

UIAlertController* deleteAlert = [UIAlertController alertControllerWithTitle:@"Unfollow?"
                                                                     message:
                                                              preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction* unfollowAction = [UIAlertAction actionWithTitle:@"Unfollow" style:UIAlertActionStyleDestructive
                                                     handler:^(UIAlertAction * action) {
                                                         //Code to unfollow
                                                     }];
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel
                                                     handler:^(UIAlertAction * action) {

                                                     }];

[deleteAlert addAction:unfollowAction];
[deleteAlert addAction:cancelAction];
[self presentViewController:deleteAlert animated:YES completion:nil];

您可以在这篇文章中找到有关如何将图像添加到 UIAlertController 的更多信息:

Add Image to UIAlertAction in UIAlertController

关于ios - 如何创建警报,在 iOS 上使用按钮从底部滑动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36116490/

相关文章:

ios - 如何添加按钮或标签以编程方式观看

ios - 为什么 Apple 简单 ping 在 iOS 上不起作用?

ios - 将数据备份到服务器时验证用户

ios - 突破障碍或停止枚举的推荐方法是什么?

ios - UIWebView 不刷新

ajax - 验证错误后没有更新字段

c# - 将控件添加到 FlowLayoutPanel 时意外的索引更改

java - 图像图标未显示在 JButton 上

java - 在控制台模式和图形模式之间切换

ruby - Ruby 中的 Qt Model/View 编程示例和教程