You need to do 2 actions in a row, that is, for example, close the modal window and return to the last controller from which you push or return and switch to a new one. If I write:
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController pushViewController:testViewController animated:YES]; So in the end I get an error.