Home Change Alertview UIAlertController Buttons and Title color in iOS
Reply: 1

Change Alertview UIAlertController Buttons and Title color in iOS

Alok
1#
Alok Published in 2017-12-06 04:53:00Z

I wanted to change my alert view title and button color as per my App theme and for this, i have found the many solutions as below:

alertController.view.tintColor = UIColor.red

But above code is changing only button title color not the Alert title.

Testing on iOS 11 using Xcode 9.1

Alok
2#
Alok Reply to 2017-12-06 05:47:28Z

Use below code to change Alert title:

 alertController.setValue(NSAttributedString(string: "test", attributes: [NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 15),NSAttributedStringKey.foregroundColor : UIColor.red]), forKey: "attributedTitle")

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.313862 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO