Sep 30, 2011

Be a UIAlertViewDelegate with less work

There’s no need to create a bunch of properties on your delegate to tell multiple UIAlertView’s apart. You can stash custom properties that can help you identify each UIAlertView on the UIAlertView’s layer. (CALayer works like a Javascript object—it’s just a bag of properties).

When you create your UIAlertView, you can assign it a recognizable ID for later:

In your delegate, do this:


QED
About