Search code examples
xcodeswiftfullscreeniadads

Show Full Screen iAd advertisement in Swift


I'm making a game in swift and I've implemented iAd successfully using Swift but it's just a small banner at the bottom of the screen now which is fine, but I also want a full-screen advertisement to pop-up when the user is game over. How do I do this? The 'Game Over' view has it's own class by the way. This is what I've got so far:

func bannerViewAdLoad(banner: ADBannerView!) {
        if !_bannerIsVisible {
            if _adBanner?.superview == nil {
                self.view.addSubview(_adBanner!)
            }
        }
        UIView.beginAnimations("animateAdBannerOn", context: nil)
        banner.alpha = 1.0
        UIView.commitAnimations()

        _bannerIsVisible = true
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
        println("Failed to retrieve Ad")

        if _bannerIsVisible {
            UIView.beginAnimations("animateAdBannerOff", context: nil)
            banner.alpha = 0.0
            UIView.commitAnimations()

            _bannerIsVisible = false
        }
}

Solution

  • Hi Please go through the this document i am not sure but it might help

    https://developer.apple.com/library/prerelease/ios/documentation/iAd/Reference/ADInterstitialAd_Ref/index.html