简体   繁体   English

UIAlertView和UIButton在白色背景上具有白色按钮

[英]UIAlertView and UIButton has white buttons on white background

After upgrading the dev iPhone 5 to iOS 8.1, all of the buttons and default labels on UINavigationBars and UIAlertViews started to appear on screen with white text. 将iPhone 5开发者升级到iOS 8.1之后,UINavigationBars和UIAlertViews上的所有按钮和默认标签开始以白色文本显示在屏幕上。

I tried to resolve the problem with: 我试图用以下方法解决问题:

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

This somehow solved the white buttons in most cases, but not all of them. 在大多数情况下,这以某种方式解决了白色按钮,但并非全部。 I'm still having problems with the alert views appearing after receiving a notification in-app, with navigation bar buttons and labels. 在收到带有导航栏按钮和标签的应用内通知后,警报视图仍然出现问题。

Has anyone experienced this problem? 有没有人遇到这个问题? And if possible has a solution? 如果可能的话,有解决方案吗?

UIAlertView上的白色按钮

One cannot customize the appearance of UIAlretView : 一个人不能自定义UIAlretView的外观:

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

Check Apple notes in class reference : 课程参考中查看Apple笔记:

Subclassing Notes 子类注释

The UIAlertView class is intended to be used as-is and does not support subclassing. UIAlertView类旨在按原样使用,并且不支持子类化。 The view hierarchy for this class is private and must not be modified. 此类的视图层次结构是私有的,不能修改。

Possible Duplicate Question: Change tint color of UIAlertview and UIActionsheet buttons 可能重复的问题: 更改UIAlertview和UIActionsheet按钮的颜色颜色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM