On Aug 5, 2009, at 12:08 PM, Agha Khan wrote:

Hi:
I need 2 alerts in my class
Code taken from (the iPhone Developer's Cookbook) and works fine with if you have only one alert. When user presses Ok/Cancel button it (void)alertView:(UIAlertView *)alertView activates function.

[snip]

Now I have another alert in same file.

[snip]

How can we distinguish which alert we are talking about?
Thanks in advance.

Use the 'tag' property (which UIAlertView inherits from UIView) to assign a unique identifier to each one, which you can then use in the delegate method to determine which one is active.

UIAlertView *alert = [[UIAlertView alloc...
alert.tag = kSomeCustomTagIdentifier;
[alert show];

Or use the title as a differentiator.

You could also assign each UIAlertView to an ivar, and compare those against the "alertView" parameter passed to the delegate method.

Or you could assign them different delegate objects.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to