【发布时间】:2019-01-25 23:02:43
【问题描述】:
一旦用户关闭插页式广告,我正在尝试将此按钮设置为新的 ViewController。 segue 代码在没有广告代码的情况下工作,而广告代码在没有 segue 代码的情况下工作。无论哪一个先发生,但我不知道如何让它们一起工作。您会注意到我尝试将self.present... 移动到不同的地方但没有成功(请参阅注释行)。
@IBAction func adButton(_ sender: UIButton) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let myVC = storyboard.instantiateViewController(withIdentifier: "newVC")
//self.present(myVC, animated: true, completion: nil)
if (interstitial.isReady) {
interstitial.present(fromRootViewController: self)
interstitial = createAd()
//self.present(myVC, animated: true, completion: nil)
}
self.present(myVC, animated: true, completion: nil)
}
【问题讨论】:
标签: swift uiviewcontroller admob segue interstitial