I have a view with some UITextViews. The user can enter person data, name, surname, email etc. When the editing is finished the user hits "Done" on the top right corner and the view navigates back to a the previous view like this:
- (void)save:(id)sender
{
[self.view.window endEditing:YES];
if (self.data ...)
{
[self updateUser];
[self.navigationController popViewControllerAnimated:YES];
}
}
The customer requested to add some validation at the some fiels, eg email. After the validation a UIAlertView informs that the data input was not valid, therefore the data are not stored. My problem is that the OK button of the AlertView calls the "save" method and the navigationController is called and the popViewControllertAnimated is called.
The problem here is that I would like after the UIAlertView to avoid the auto navigation to the previous view (via popViewControllerAnimated) and more precisely I would like to stay on my edit view and type a new valid email.
The code for the alert view is
- (void)alertInvalid {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"" message:NSLocalizedString(@"res_CurrentPasswordErrorAlert",nil)
delegate:nil cancelButtonTitle: NSLocalizedString(@"res_OK",nil) otherButtonTitles:nil];
[alertView show];
}
which is called via the -(BOOL)textFieldShouldEndEditing:(UITextField *)textField
method.
So, how do I modify my code in order after the alert message the current UITextView to become responsive again?