我有一个标签视图控制器,它有一个像这样的按钮,当它被按下时,会出现一个模态:
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.
当presentViewController完成时调用CompletionBlock.
PostViewController *post = [[PostViewController alloc] init]; [con presentViewController:post animated:YES completion:^{ ProfilesViewController *profile = [[ProfilesViewController alloc] init]; [self.navigationController pushViewController:profile animated:YES]; }];
有关presentViewController的更多信息:animated:completion:Apple Doc
completion : The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。