Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i customize UIAlertAction in UIAlertController for iOS8?

I need to add image in Action sheet item using UIAlertController. I add using:

UIImage *image = [UIImage imageNamed:@"icon.png"];
[alertAction setValue:image forKey:@"image"];

And results as:

UIActionSheet

The problem is that: I need the image & text to be centrally aligned and resize the height of Cancel button

How can i do that, please share some code.

Thanks!

like image 427
pankaj asudani Avatar asked Mar 24 '15 06:03

pankaj asudani


1 Answers

Well, here is the Runtime Header file for UIAlertAction. You can neither change the frame of image nor you can change the height of Cancel button.

So what is the solution?

The only solution that I could figure is to make a custom view with UIVisualEffect and show/animate it like UIActionSheet. Basically you need to imitate UIActionSheet.

That said, I would like to welcome other solutions as well.

like image 80
Burhanuddin Sunelwala Avatar answered Oct 21 '22 06:10

Burhanuddin Sunelwala