1

I'm trying to style the text label in a UIAlertView, but I can't make it work. I have a global style that makes all label text black, but the UIAlertView background is black, so I want to make labels in Alerts white. My css is this:

label
{
  color: black;
}

action-sheet label 
{
   color: white;
}

The first rule correctly makes all label text black, but the second rule doesn't make it white, and so my UIAlertViews are unreadable. What am I doing wrong?

Joshua Frank
  • 13,120
  • 11
  • 46
  • 95

2 Answers2

2

We chose not to support styling UIAlertViews, since Apple forbids it in their documentation, here and here.

Styling low level views with element selectors like label {} and button {} may incidentally style UIAlertViews. We recommend using more specific selectors to prevent that.

ForceMagic
  • 6,230
  • 12
  • 66
  • 88
pixatebob
  • 63
  • 4
  • So if I want a styled alert, would you recommend making a custom view? – Joshua Frank Jan 13 '14 at 21:31
  • Yes @JoshuaFrank. You raise a point that @pixatebob might like to hear: Pixate could simply make a custom view as an alternative to a `UIAlertView`, which I criticize Apple for not allowing more customization where they certainly should. – jakenberg Mar 07 '14 at 18:53
0

I'm fairly certain it's not possible yet. But with iOS 7, Apple announced that UIAlertViews could be subclassed and styled (or something along those lines), so perhaps this is on Pixate's radar to implement soon.

Update...

This looks like a decent way to get custom alert views while using Pixate styles:

https://github.com/seivan/SHAlert

Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128