How to customize Uialertview?

Asked

Viewed 103 times

2

Setting:

Change colors, and buttons UIAlertView. How to use images to make this customization. For example: Add image in the background, and change the color of the locked screen behind the alert.

If the question has become vague, or difficult to understand, just make a comment so I can enter more information about the doubt.

  • It is also worth remembering that the UIAlertView is obsolete in the iOS 8, replaced by UIAlertController.

2 answers

4


To customize a UIAlertView, this being a UIView any, you could simply create a subclass of this and make the changes you want, even overriding the layoutSubviews:, as shown in that tutorial.

And why could? Because the chances of you getting to publish an app like this is almost zero. See that in the reference of this class there is a note about it, this class is private and should not be modified:

The UIAlertView class is intended to be used as-is and does not support subclassing. The view Hierarchy for this class is private and must not be modified.

But like I said, UIViewAlert is a UIView any, then you can make your own alert, it means from scratch, mount your view with the necessary buttons, background, overlay and delegates.

For this, the answer would be very wide involving several details, so I recommend you at least start from this idea and in the course of its development go removing the doubts.

I hope it helped.

  • Thanks @Paulorodrigues! I’ll look here and try to publish anyway. Thank you!!

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.