In iOS UIAlertController, is it possible to align UIAlertAction text

I need to implement a UIAlertController, for example, this UIAlertController with the left name UIAlertAction

description1

After searching quite a bit on the Internet, and here on stackoverflow, I was able to achieve a left-aligned UIAlertController header

description2

But how to align UIAlertAction text?

Any help / hint would be very helpful.

+6
source share
2 answers

Someone posted a new question regarding the same:

UIAlertAction Text Styling .

I was looking for the same thing, and from what I learned, you can change the style and alignment of the text when you use the UIAlertController in the presentation style .alert , but not when you use it with the UIAlertAction elements in the style of .actionSheet .

Only the reference here seems to use libraries that provide custom implementations, such as XLActionController .

Changing text alignment for the UIAlertController as a whole in the .alert style responds to: UIAlertController Text Styling .

I tried to use the same method for UIAlertAction , but this led to some Key-Value compliance / Undefined key exceptions, and the controller did not display.

0
source

Yes you can, with the following

 [(your uialertaction object) setValue:@0 forKey:@"titleTextAlignment"] 
0
source

All Articles