如何为segue swift添加函数

时间:2015-05-09 10:11:30

标签: ios swift admob segue

如何在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)
}

0 个答案:

没有答案