如何在iOS7中更改UIAlertView的按钮文字颜色? [英] How to change button text color of UIAlertView in iOS7?

查看:428
本文介绍了如何在iOS7中更改UIAlertView的按钮文字颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS7推出了一般的色彩。我认为 UIAlertView 也在有效范围内,但实际上tintColor看起来不适用于 UIAlertView 。 (对于可点击的按钮文字颜色)

iOS7 introduced general tint-color. I think UIAlertView is also in the valid range, but actually tintColor doesn't look to work with UIAlertView. (for tappable button text color)

是否可以更改警报视图的色调?如果可能的话,怎么改呢?

Is it possible to change the tint-color of alert view? If possible, how to change it?

推荐答案

不幸的是你不能自定义警报视图的外观,不可能改变按钮文字颜色。

Unfortunately you cannot customize the appearance of alert views, it is impossible to change the buttons text color.

UIAlertView类参考


UIAlertView类旨在用作 - 是和不是
支持子类化。此类的视图层次结构是私有的,并且不得修改

The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

更新:

问题是关于iOS7,但现在 UIAlertView 已弃用, UIAlertController 您只需更改视图色调颜色:

The question was about iOS7, but now UIAlertView is deprecated, for UIAlertController you can simply change the view tint color:

    let alert = UIAlertController(title: "Gimme a break",
                                message: "For God sake its iOS7 question!",
                         preferredStyle: .alert)
    alert.view.tintColor = UIColor.red

检查这个问题也很有帮助:如何更改iOS9中的UIAlertController按钮文字颜色?

It is helpful also to check this question: How to change UIAlertController button text colour in iOS9?

这篇关于如何在iOS7中更改UIAlertView的按钮文字颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆