Translate

martes, 5 de marzo de 2013

IOS Popup Messages



You can create popup messages showing a title, a message, an a set of buttons. In my example the button "Clear Data" call this popup message to confirm the action. These are the steps needed to create the popup message:

1. Add to the interface of your header file.

2. Create the alert message with the following code:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"WARNING"
                                                                     message:@"All data wil be erased. Are you sure?"
                                                                     cancelButtonTiltle:@"Cancel",
                                                                     otherButtonTitles:@"Ok", nil ];
[alert show]
[alert release]  ------> if you have ARC enabled don´t use this line.


3. And finally you must use the following method  to control which button was pressed, and its associated action.


-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex







No hay comentarios: