Re: How can we distinguish which alert we are talking about?
Re: How can we distinguish which alert we are talking about?
- Subject: Re: How can we distinguish which alert we are talking about?
- From: Randall Meadows <email@hidden>
- Date: Wed, 5 Aug 2009 12:22:04 -0600
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 (email@hidden)
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:
This email sent to email@hidden