0

我有三个视图控制器,a、b 和 c。我从a开始,呈现b。如果用户已注销,则显示 c。否则我留在 b 上,下面的代码片段来自哪里。如果我只从 a 转到 b,presentingViewController则设置为 a,一切都很好。如果出现 c,一旦我关闭 c,presentingViewController就会返回nil并且我被困在 b 上。

UIViewController* parent = self.navigationController.presentingViewController;
self.navigationController.viewControllers = @[[[UIViewController alloc] init]];
[parent dismissModalViewControllerAnimated: NO];
[parent presentModalViewController: self animated: NO];
[parent dismissModalViewControllerAnimated: YES];
4

1 回答 1

1

Solved by sending a reference of a to b and using that as the parent :)

于 2012-10-03T14:39:28.467 回答