This is a weird one. I'm making a UIAlertController with the following code:
let optionMenu = UIAlertController(title: nil, message: "Choose Option", preferredStyle: UIAlertControllerStyle.ActionSheet)
let action = UIAlertAction(title: "Action 1", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
print("Cancelled")
})
let action2 = UIAlertAction(title: "Action 2", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
print("Cancelled")
})
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
(alert: UIAlertAction!) -> Void in
print("Cancelled")
})
optionMenu.addAction(cancelAction)
optionMenu.addAction(action)
optionMenu.addAction(action2)
self.presentViewController(optionMenu, animated: true, completion: nil)
And here's what it looks like on screen. The options are dim (I believe pulling in or being affected by the rear views).
Dimmed Options
I was able to add this code to make it pure white, but the nice-ness of the separation goes away.
let subview = optionMenu.view.subviews.first! as UIView
let alertContentView = subview.subviews.first! as UIView
alertContentView.backgroundColor = UIColor.whiteColor()
alertContentView.layer.cornerRadius = 2
And it looks like this: Non-dimmed, but not quite right
Any ideas on how to not let the background affect the options in the UIAlertController?
I added this UIAlertController to a page with a white background and it looked like it should.
Thanks!
It's not a bug. Nothing is "dimmed". The alert buttons are translucent, so they are darker over a dark background. They are also reddish over a red background and bluish over a blue background; that's what translucent means. All action sheets in all apps look like this. There's no problem here. Don't worry, be happy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With