Skip to content

Instantly share code, notes, and snippets.

@daniel-rueda
Created December 13, 2011 16:30
Show Gist options
  • Save daniel-rueda/1472792 to your computer and use it in GitHub Desktop.
Save daniel-rueda/1472792 to your computer and use it in GitHub Desktop.
Add tags to AlertView
// Crear alerta, asignar delegate y tag
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"You must register a Facebook account first"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK"];
alert.tag = 101;
[alert show];
[alert release];
// Verificar tag en el metodo del delegate
#pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (alertView.tag) { // comparar tag
case 1:
break;
case 101:
break;
default: // Ejecutar esto cuando NO se asigno ningun tag
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment