在swift中设置UIAlertView按钮的颜色 [英] Setting UIAlertView button's color in swift

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

问题描述

我是一个新的快速程序员,我需要更改UIAlertView按钮颜色的颜色。例如,我想将其UIColor更改为黄色。你可以帮我吗?

i'm a new swift programmer and i need to change the color of my UIAlertView's button's color. for example i want to change the UIColor of that to yellow. can you help me please?

推荐答案

你可以改变 tintColor 之类的所以:

You can change the tintColor like so:

alert.view.tintColor = UIColor.blackColor()

但Apple不赞成自定义 UIAlertView

But customizing a UIAlertView is frowned upon by Apple.


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.

UIAlertView类参考

替代虽然。

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

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