【问题标题】:UIAlertView and UIButton has white buttons on white backgroundUIAlertView 和 UIButton 在白色背景上有白色按钮
【发布时间】:2014-11-19 10:10:13
【问题描述】:

将开发版 iPhone 5 升级到 iOS 8.1 后,UINavigationBars 和 UIAlertViews 上的所有按钮和默认标签开始以白色文本出现在屏幕上。

我尝试通过以下方式解决问题:

// UIView tints
[[UIView appearance] setTintColor:[UIColor blackColor]];
[[UIAlertView appearance] setTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];

这在大多数情况下以某种方式解决了白色按钮,但不是全部。我在收到应用内通知后出现的警报视图仍然存在问题,带有导航栏按钮和标签。

有人遇到过这个问题吗?如果可能的话有解决办法吗?

【问题讨论】:

  • 默认为蓝色 尝试评论 [[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
  • 您可以尝试全局更改它们 [self.window setTintColor:[UIColor blackColor]];将代码放入Application delegate
  • Radu,评论说不会改变结果。 bplat,已经尝试过了,但没有成功。

标签: ios objective-c


【解决方案1】:

无法自定义UIAlretView的外观:

[[UIAlertView appearance] setTintColor:[UIColor blackColor]];

查看class reference中的Apple注释:

子类化注释

UIAlertView 类旨在按原样使用 并且不支持子类化。这个类的视图层次结构是 私有,不得修改。

可能的重复问题:Change tint color of UIAlertview and UIActionsheet buttons

【讨论】:

  • 我不想自定义外观。在 8.1 中,按钮标签是白色的,而 8.0 是黑色的。我正在尝试纠正差异。
猜你喜欢
  • 1970-01-01
  • 2015-03-15
  • 1970-01-01
  • 2013-11-27
  • 2020-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多