我有一个选项卡视图控制器,它具有一个类似的按钮,当按下它时,将出现一个模态:
PostViewController *post = [[PostViewController alloc] init];
// [self.navigationController pushViewController:post animated:YES];
// Presentation
[self presentViewController:post animated:YES completion:nil];
模态完成后,我想将其关闭,然后按下一个新的视图控制器:
ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[self.navigationController pushViewController:profile animated:YES];
但是我不能在vc中将其作为模态来执行。我该怎么做呢?
您可以尝试使用completionBlock
。
CompletionBlock
在presentViewController完成后调用。
PostViewController *post = [[PostViewController alloc] init];
[con presentViewController:post animated:YES completion:^{
ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[self.navigationController pushViewController:profile animated:YES];
}];
有关Apple Doc的更多信息presentViewController:animated:completion:
complete:演示完成后要执行的块。该块没有返回值,并且没有参数。您可以为此参数指定nil。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句