![](/img/trans.png)
[英]Need assistance dismissing modally presented ViewController and popping ViewController from UINavigationController
[英]Dismissing a viewController presented by a push notification
我在d idReceiveRemoteNotification
提供了一個testViewController
作為rootViewController
,它可以很好地工作。 然后,當我按下testViewController
的后退按鈕(回到“mainViewController”,在這種情況下是 - dismissViewController
- )時,沒有任何反應。 我知道發生這種情況是因為它被呈現為rootView ..並且沒有什么可以解雇的。 我如何控制testViewController
顯示位置或方式,以便在按下后退按鈕時決定如何繼續? 我希望你明白我想說的話。 任何意見將是有益的。
先感謝您
ChatViewController *chat = [[ChatViewController alloc] initWithNibName:@"ChatViewController" bundle:nil];
[_window.rootViewController presentViewController:chat animated:YES completion:nil];
你不應該把它設置為rootViewController
,而是讓你的rootViewController
將它作為模態視圖控制器呈現:
[self.window.rootViewController presentViewController:testViewController animated:YES completion:nil]
當你調用-dismissViewControllerAnimated:completion:
消息時,它應該返回你的rootViewController
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.