Pressing the navigation controller after displaying the modal controller

I have a tab view controller that has such a button, and when it is clicked, a modal view appears:

PostViewController *post = [[PostViewController alloc] init]; // [self.navigationController pushViewController:post animated:YES]; // Presentation [self presentViewController:post animated:YES completion:nil]; 

When the modal is finished, I want to reject it and click on a new controller of the form as follows:

 ProfilesViewController *profile = [[ProfilesViewController alloc] init]; [self.navigationController pushViewController:profile animated:YES]; 

But I can not do it in post vc as its modal. How to do it?

+6
source share
2 answers

You can try using completionBlock .

completionBlock is called when currentViewController is executed.

 PostViewController *post = [[PostViewController alloc] init]; [con presentViewController:post animated:YES completion:^{ ProfilesViewController *profile = [[ProfilesViewController alloc] init]; [self.navigationController pushViewController:profile animated:YES]; }]; 

Learn more about presentViewController:animated:completion: Apple Doc

completion: a block to execute after the presentation ends. This block has no return value and does not accept any parameters. You can specify nil for this parameter.

+7
source

Call tab display controller built into UINavigationController? If you have not done so, you certainly cannot use self.navigationController.

+1
source

Source: https://habr.com/ru/post/976477/


All Articles