- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAlertController *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"Are you sure you want to Delete your account ?"
delegate:self
cancelButtonTitle:@"Delete Account"
otherButtonTitles:@"Cancel", nil];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
//Do Some action here
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"logged_in"];
// alert.tag = 104;
// [alert show];
[self displayAlertForRemoveAccountWithMessage:@"Are you sure you want to Delete your account ?"];
UINavigationController *nav = [self.storyboard instantiateViewControllerWithIdentifier:@"stratingNav"];
[nav setModalPresentationStyle: UIModalPresentationOverFullScreen];
[self presentViewController:nav animated:YES completion:nil];
}];
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:ok];
[alert addAction:cancel];
[self presentViewController:alert animated:YES completion:nil];
}
- (void)displayAlertForRemoveAccountWithMessage :(NSString *)message
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:message
delegate:self
cancelButtonTitle:@"Delete Account"
otherButtonTitles:@"Cancel", nil];
alert.tag = 103;
[alert show];
}
i am trying to implement delete account function with objective c kindly please tell me what else need to be added in this code..