我正在尝试用一个黑色的主题定制我的UIAlertController。
我的目标是这样的

我正在尝试不同的东西,包括我在这里找到的建议https://stackoverflow.com/a/29122883/1817873,但是由于某种原因,只有第一个按钮被着色,而cancel按钮保持白色。
这是我的代码:
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];有什么想法吗?
发布于 2016-03-15 22:00:53
有什么想法吗?
是。放弃吧。警报控制器是非常有限的,您应该坚持它所做的。但是它只是一个呈现的视图控制器,没有什么能阻止您制作自己的视图控制器,它看起来和行为就像警报一样,因为它是您的视图控制器,它是您的视图,您可以做任何您喜欢的事情。
https://stackoverflow.com/questions/36022914
复制相似问题