Created
December 13, 2011 16:30
-
-
Save daniel-rueda/1472792 to your computer and use it in GitHub Desktop.
Add tags to AlertView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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