ios - 如何增加 UIAlertAction 中的 Alpha?

标签 ios uialertcontroller

当我使用 AlertControlAction 时,它会接管屏幕,直到您按下取消或诸如此类的东西。

我想知道有没有办法增加周围灰色部分的Alpha?

enter image description here

最佳答案

您可以根据需要设置 Alpha,这在任何情况下都会产生一定的透明度。

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Alert title" message:@"Alert message" preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:ok];

alertController.view.backgroundColor = [UIColor colorWithWhite:1 alpha:0.6];

[self presentViewController:alertController animated:YES completion:nil];

关于ios - 如何增加 UIAlertAction 中的 Alpha?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34713994/

相关文章:

swift - 尝试呈现 <UIAlertController : 0x7d92f000> on <test. ViewController: 0x7c87a990> 其 View 不在窗口层次结构中

ios - UIAlertController EXC_BAD_ACCESS 错误 - Swift

swift - 尽管控制台指示事件,但按下导航栏按钮时 UIAlertController 未显示?

ios - 如何在按住手指时通过预览当前项目来模仿 iOS 键盘行为?

ios - 快速将单击、双击和三次点击手势添加到自定义键盘中的所有 "buttons"

ios - 设置键盘首字母大写

swift - 通过从警报 View Controller 中选择操作将项目添加到分段 Controller

iphone - Instagram 等应用中使用的存储类型

ios - 尝试使用 Swift AVPlayer 播放音频

ios - setVisibleCooperativeBounds 从未设置确切的边界