iosobjective-cuitableviewuialertview

Display alertview while deleting data in plist


I want to delete data in UITableView using plist and I want to put alertview when delete button is pressed. I want to mention that I have used edit button to delete the data from tableview. code of edit button is as follows:

 self.navigationItem.leftBarButtonItem=self.editButtonItem;

How can I solve this problem?


Solution

  • In your function write :

         UIAlertView    *alertView = [[UIAlertView alloc] initWithTitle: @"" message: @"" delegate: self cancelButtonTitle: @"OK" otherButtonTitles: nil];
    alertView.tag = 1;
            [alertView show];
            [alertView release];
    

    On alert "OK" button pressed

      - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
            { 
        if(buttonIndex==0)
            {
        if (alertView.tag == 1)
            {
        //Do your code
        }
       }
     }
    

    Hope it helps...