gpt4 book ai didi

ios - 在用户关闭广告之前防止 Segue?

转载 作者:行者123 更新时间:2023-11-28 10:57:13 26 4
gpt4 key购买 nike

我正在将插页式广告集成到我的应用中的几个 segues。

问题是间隙负载,然后由 segue 触发立即无效。

有没有一种方法可以暂停函数,直到广告关闭后才运行 segue?那是我能想到的解决这个问题的唯一方法。代码如下:

@IBAction func closeExerciseDetails(_ sender: Any) {
if (self.interstitial.isReady) {
self.interstitial.present(fromRootViewController: self)
self.interstitial = self.createAd()
}
self.performSegue(withIdentifier: "unwindToExercisesSegue", sender: self)
}

编辑:新代码不起作用...

@IBAction func closeExerciseDetails(_ sender: Any) {
if (self.interstitial.isReady) {
self.interstitial.present(fromRootViewController: self)
self.interstitial = self.createAd()
}
}

func interstitialDidDismissScreen(_ ad: GADInterstitial) {
self.performSegue(withIdentifier: "unwindToExercisesSegue", sender: self)
}

最佳答案

为此有一个委托(delegate):

- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial {
}

你可以只在这个委托(delegate)中执行 segue。

关于ios - 在用户关闭广告之前防止 Segue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42625475/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com