我做了一些研究并阅读了我在这里找到的其他答案,但没有找到任何真正有效的东西。我有一个应用程序,当发布某些内容时,我想转到帖子,如果在查看帖子时按下后退按钮,它应该返回两个视图,基本上跳过撰写视图。
以下是我尝试过的,但它给出了
警告:尝试呈现不在窗口层次结构中的视图!
-(IBAction)post{
[[self presentingViewController] dismissModalViewControllerAnimated:NO];
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
ViewPostViewController *dvController = [[ViewPostViewController alloc] initWithNibName:@"ViewPostViewController" bundle:[NSBundle mainBundle]];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:dvController];
nc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:nc animated:NO];
[nc release];
}