6

I Need to implement a UIAlertController such as this UIAlertController with left alligned UIAlertAction

description1

After searching quite a lot in the internet and here in stackoverflow, I was able to achieve left aligned title of UIAlertController

description2

But how to left align text of UIAlertAction ?

Any help/clue would be very helpful.

Adeel
  • 2,066
  • 1
  • 17
  • 28
Anand Reddy
  • 61
  • 1
  • 3

2 Answers2

1

Yes you can, with the following

[(your uialertaction object) setValue:@0 forKey:@"titleTextAlignment"]
Jean-François Corbett
  • 34,562
  • 26
  • 126
  • 176
0

Someone posted a newer question regarding the same thing at:

UIAlertAction Text Styling.

I was searching for the same thing and from what I have learned, you can only change text styling and alignment when you're using a UIAlertController in the .alert presentation style, but not when you're using it with UIAlertAction items in .actionSheet presentation style.

Only recourse here seems to be using libraries that provide custom implementations such as XLActionController.

Modifying text alignment for the UIAlertController as a whole in .alert presentation style is answered at: UIAlertController Text Styling.

I tried to use the same method for UIAlertAction but that resulted in some Key-Value compliance / Undefined key exceptions and the controller not displaying.

somedev
  • 458
  • 8
  • 20