簡體   English   中英

解除推送通知所呈現的viewController

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM