在 swift 中设置 UIAlertView 按钮的颜色

Setting UIAlertView button's color in swift

我是一名新 swift 程序员,我需要更改 UIAlertView 按钮的颜色。例如,我想将它的 UIColor 更改为黄色。你能帮帮我吗?

您可以像这样更改 tintColor

alert.view.tintColor = UIColor.blackColor()

但是定制 UIAlertView 是 Apple 不赞成的。

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 Class Reference

虽然有alternatives