简体   繁体   中英

Change UIAlertViewController Tint Color

I am using google sign in for my swift application. When the user clicks to sign in the API gives this UIAlert . Is there any way to change the tint colour of this? Ie the "Cancel" & "Continue"?

UIAlertView

I have even tried to change it globally using AppDelegate code below;

UIView.appearance(whenContainedInInstancesOf: [UIAlertController.self]).tintColor = Color.brandPurple

This has no effect.

Just set tintColor of UIAlertController.

 alertController.view.tintColor = Color.brandPurple // alertController is the object of UIAlertController

You have two options, (And duo to the name of the color you used and method you already tried, probably first option is what you are looking for)

All alerts (and other stuff)

you can change the window 's tintColor

it could be accessed from any view

view.window?.tintColor = Color.brandPurple

Just a single alert

Change that single alert's view's tintColor

alertController.view.tintColor = Color.brandPurple

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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