KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to call and alert when a button is pressed. i use this : -(IBAction)Add { UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"add button pressed" message:@"Add to record" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil ]; [alert show]; [alert release]; } ok , no problem here, two button came up, OK and cancel. Now i want detect which button is pressed i use: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { // the user clicked one of the OK/Cancel buttons if (buttonIndex == 0) { //just to show its working, i call another alert view UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"OK WORKIng well" message:@"no error" delegate:nil cancelButtonTitle:@"IWORKS" otherButtonTitles:@"NO PRB", nil]; [alert show]; [alert release]; } else { NSLog(@"cancel"); } } now here is the problem. i cannnot detect which button is pressed; the 2nd alertview doesnt show. i've check through the code a couple of times, there doesn't seem to be any problem with it. no error/warning too.
Tags (comma-separated)
Save Edits
Cancel