0

我有三個視圖控制器,a,b和c。我從一開始,現在b。如果用戶註銷,則顯示c。否則我留在b,下面的代碼片段來自。如果我只是從a到b,presentingViewController設置爲a,一切都很好。如果提交c,一旦我解僱c,presentingViewController返回nil,我被困在b上。PresentingViewController被設置爲零

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

回答

1

通過發送的參考至b,並將它作爲父解決:)