/ Published in: Objective C
                    
                                        
You must add UIAlertViewDelegate to the protocols for your class
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// confirm the deletion..
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: theTitle
message: msg
delegate: self
cancelButtonTitle: @"Cancel"
otherButtonTitles: @"Delete", nil];
alert.tag = LIST_CONFIRM_DELETE; // should use a different define (e.g. to 1) each time you use an alertview in a class, as each will call the same clickedButtonAtIndex selector.
[alert show];
[alert release];
// Called when an alertview button is clicked
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (alertView.tag) {
case LIST_CONFIRM_DELETE:
{
switch (buttonIndex) {
case 0: // cancel
{
NSLog(@"Delete was cancelled by the user");
}
break;
case 1: // delete
{
// do the delete
}
break;
}
break;
default:
NSLog(@"WebAppListVC.alertView: clickedButton at index. Unknown alert type");
}
}
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                