iAd非页内广告不是全屏

时间:2016-03-06 07:27:05

标签: ios xcode swift iad interstitial

我尝试在从此VC转换到另一个VC的过程中有一个插页式广告全屏。它不是全屏。导航栏,iAd横幅视图和标签栏都在视图中,而非插页式广告是全屏广告。

此外,当他们转换到detailedVC时,不会打开,而是在他们点击后退按钮时发生。

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    let svc = segue.destinationViewController as! DetailedViewController

    if segue.identifier == "ShowDetailedCandidate"{
        let indexPath: NSIndexPath = self.tableview.indexPathForSelectedRow!

        // Logic was here that is unrelated

        closeButtons()
        loadAd()
    }
}

func close(sender: UIButton) {
    closeButton.removeFromSuperview()
    interAdView.removeFromSuperview()
}
func loadAd() {
    interAd = ADInterstitialAd()
    interAd.delegate = self
}
func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
    interAdView = UIView()
    interAdView.frame = self.view!.frame
    view!.addSubview(interAdView)
    interAd.presentInView(interAdView)
    UIViewController.prepareInterstitialAds()
    interAdView.addSubview(closeButton)
}
func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
}
func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
    closeButton.removeFromSuperview()
    interAdView.removeFromSuperview()
}
func closeButtons(){
    closeButton.frame = CGRectMake(20, 20, 30, 30)
    closeButton.layer.cornerRadius = 15
    closeButton.setTitle("x", forState: .Normal)
    closeButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
    closeButton.backgroundColor = UIColor.whiteColor()
    closeButton.layer.borderColor = UIColor.blackColor().CGColor
    closeButton.layer.borderWidth = 1
    closeButton.addTarget(self, action: "close:", forControlEvents: UIControlEvents.TouchDown)
}

0 个答案:

没有答案