Estoy tratando de llamar y alertar cuando se presiona un botón. Yo uso esto:Botón de detección clic con UIAlertView
-(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];
}
bien, no hay problema aquí, aparecieron dos botones, OK y cancelar. Ahora quiero detectar qué botón está presionado yo uso:
- (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");
}
}
ahora aquí está el problema. no puedo detectar qué botón se presiona; la segunda alerta no se muestra. He revisado el código un par de veces, no parece haber ningún problema con él. ningún error/advertencia también.
Mostrar una alerta directamente después de otra alerta probablemente no sea una buena idea, solo un consejo. – vakio