How can we distinguish which alert we are talking about?
How can we distinguish which alert we are talking about?
- Subject: How can we distinguish which alert we are talking about?
- From: Agha Khan <email@hidden>
- Date: Wed, 05 Aug 2009 11:08:14 -0700
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.
- (void) presentSheet
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Enter Information"
message:@"Specify the Name and URL"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:
(NSInteger)buttonIndex
{
printf("User Pressed Button %d\n", buttonIndex + 1);
printf("Text Field 1: %s\n", [[[alertView textFieldAtIndex:0] text]
cStringUsingEncoding:1]);
printf("Text Field 2: %s\n", [[[alertView textFieldAtIndex:1] text]
cStringUsingEncoding:1]);
[alertView release];
}
Now I have another alert in same file.
- (void) presentSheet2
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"need Information"
message:@"Have you heard from Apple"
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
[alert show];
}
How can we distinguish which alert we are talking about?
Thanks in advance.
Agha
_______________________________________________
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