I'm use the following code to present a UIAlertController action sheet with the item text as red. I've used the tint property to set the color.
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
alertController.view.tintColor = [UIColor redColor];
The text color seems to be defaulting to blue on highlight or selection. Is this normal and how do I stop this?
UIAlertController is availabel iOS 8 and later , thus there is a bug for devices with older version. There's no problem for devices with corresponding or higher version.
You can also change the app tint color in appdelegate.
works perfect for me.
I am still confused what you want to achieve. But you can try the Apple's way of creating
Destructive
buttons(by default text color is red).The code where you are creating
UIAlertAction
s don't use theDefault
style for the buttons you want in red color. Instead useUIAlertActionStyleDestructive
. Sample Code :Update for Swift 4, Xcode 9
You can change button colour like this
By Using this line [button setValue:[UIColor redColor] forKey:@"titleTextColor"]; You can change the button colour of your action sheet
Set your tint color in
traitCollectionDidChange
in a subclass ofUIAlertController
.