[英]DismissView and push (or performSegueWithIdentifier) after Receive Remote Notification on appDelegate by swift?
在收到远程通知后,如何在appDelegate文件上向ViewController呈现模态的情况下,将pushViewController推送到dismissViewControllerAnimated函数?
我尝试了feedVc.navigationController?.pushViewController(vc1,animation:true),但是什么也没发生。
这是我文件中的一些代码。
// AppDelegate.swift
self.window?.rootViewController = storyboard.instantiateViewControllerWithIdentifier("tabberController") as! DefaultTabbarController // this is FeedsViewController
let navigationController = storyboard.instantiateViewControllerWithIdentifier("beatingDealView") as! UINavigationController
let bealBiddingVc: BeatBiddingModalViewController = navigationController.topViewController as! BeatBiddingModalViewController
bealBiddingVc.dealId = tempDealId
bealBiddingVc.beatBiddingText = tempDealText
bealBiddingVc.dealName = tempDealName
self.window?.rootViewController?.presentViewController(navigationController, animated: true, completion: {})
// BeatBiddingModalViewController.swift
self.dismissViewControllerAnimated(true, completion: {
let vc1: DealInsideViewController = self.storyboard?.instantiateViewControllerWithIdentifier("pushDealInsideFirstView") as! DealInsideViewController
let feedVc:FeedsViewController = self.storyboard?.instantiateViewControllerWithIdentifier("feedsDisplayView") as! FeedsViewController
feedVc.feedsTableClickCheck = false
feedVc.dealIdFromNoti = self.dealId
feedVc.navigationController?.pushViewController(vc1, animated: true)
})
您在FeedsViewController中创建DealInsideViewController的方式将与模式视图一起处理。 在我看来,最好的方法是如果您创建DealInsideViewController并在viewDidLoad中从中调用FeedsViewController,那么当您关闭FeedsViewController时,您将返回DealInsideViewController而不是在appDelegate中
尝试这个:
self.window?.rootViewController = storyboard.instantiateViewControllerWithIdentifier("tabberController") as! FeedsViewController
let navigationController = storyboard.instantiateViewControllerWithIdentifier("beatingDealView") as! UINavigationController
let bealBiddingVc: BeatBiddingModalViewController = navigationController.topViewController as! BeatBiddingModalViewController
bealBiddingVc.dealId = tempDealId
bealBiddingVc.beatBiddingText = tempDealText
bealBiddingVc.dealName = tempDealName
self.window?.rootViewController?.presentViewController(navigationController, animated: true, completion: {})
要关闭弹出窗口,只需调用dismissPopoverAnimated
,这将带您回到FeedsViewController
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.