【发布时间】:2016-03-15 21:51:52
【问题描述】:
我正在尝试使用深色主题自定义我的 UIAlertController。
我的目标是这样的
我正在尝试不同的东西,包括我在这里找到的建议 https://stackoverflow.com/a/29122883/1817873,但由于某种原因,只有第一个按钮会着色,而取消按钮保持白色。
这是我的代码:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDefault handler:nil];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:deleteAction];
[alert addAction:cancelAction];
UIView *firstView = alert.view.subviews.firstObject;
UIView *nextView = firstView.subviews.firstObject;
nextView.backgroundColor = [UIColor blackColor];
有什么想法吗?
【问题讨论】:
-
尝试 UIAlertActionStyleDefault 为取消操作的样式
-
小心 - 像这样自定义 UIAlertController 可能会被 App Store 拒绝。
标签: ios customization uialertcontroller