如何改变UIAlertController的色调? [英] How to change tint color of UIAlertController?

查看:87
本文介绍了如何改变UIAlertController的色调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以更改 UIAlertController 的颜色吗?标准颜色是蓝色。它与标准的iOS应用程序非常接近。如果它是可定制的?我怎样才能改变这个颜色?例如按钮颜色。

Can I change colors of the UIAlertController ? A standard color is a blue color. And it's much close to the standard iOS apps. If it's customizable? How can I change colors of this? For example a button color.

谢谢!

推荐答案

你可以只是更改底层视图的 tintColor ,因为iOS 9中引入了一个已知错误( https://openradar.appspot.com/22209332 ),tintColor被应用程序窗口的 tintColor 覆盖。

You could just change the tintColor of the underlying view, however, due to a known bug introduced in iOS 9 (https://openradar.appspot.com/22209332), the tintColor is overridden by the application window's tintColor.

您可以:


  1. 更改应用 AppDelegate中的tintColor

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
    self.window.tintColor = UIColor.redColor()
    return true
}


  • 重新应用完成块中的颜色。

  • Reapply the color in the completion block.

    self.presentViewController(alert, animated: true, completion: {() -> Void in
        alert.view.tintColor = UIColor.redColor()
    })
    


  • 这篇关于如何改变UIAlertController的色调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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