How can i customize UIAlertAction in UIAlertController for iOS8?

房东的猫 提交于 2019-12-29 06:54:11

问题


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:

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!


回答1:


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.



来源:https://stackoverflow.com/questions/29226050/how-can-i-customize-uialertaction-in-uialertcontroller-for-ios8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!