如何在segue
运行时运行此广告? Segue
(模态)正在发挥作用。我以编程方式编写了它。但是当我试图播放广告时,我无法做到。我该怎么办呢?
var interstitial: GADInterstitial!
func createAndLoadInterstitial() -> GADInterstitial {
var interstitial = GADInterstitial(adUnitID: "ca-app-pub-5378899862041789/2782958552")
interstitial.delegate = self
interstitial.loadRequest(GADRequest())
return interstitial
}
func getAd(){
if (self.interstitial.isReady)
{
self.interstitial.presentFromRootViewController(self)
self.interstitial = self.createAndLoadInterstitial()
}
}
@IBAction func webView(sender: UIButton) {
getAd()
performSegueWithIdentifier("mapView", sender: nil)
}