1
I’m trying to include a fullscreen Iad in an app, but the advertising screen is appearing without the close button, the doubt is whether I have to do it by hand or has some hidden option for it?
I found older things about it, but I don’t know if they still reflect the current reality.
Follows the base of the code I’m using, but in a file "empty".
import UIKit
import iAd
class ViewController: UIViewController, ADInterstitialAdDelegate{
var interstitialAd:ADInterstitialAd!
var interstitialAdView: UIView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func chamarIAd(sender: AnyObject) {
loadInterstitialAd()
}
func loadInterstitialAd() {
println("loadInterstitialAd")
interstitialAd = ADInterstitialAd()
interstitialAd.delegate = self
}
func interstitialAdWillLoad(interstitialAd: ADInterstitialAd!) {
println("interstitialAdWillLoad")
}
func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
println("interstitialAdDidLoad")
interstitialAdView = UIView()
interstitialAdView.frame = self.view.bounds
view.addSubview(interstitialAdView)
interstitialAd.presentInView(interstitialAdView)
UIViewController.prepareInterstitialAds()
}
func interstitialAdActionDidFinish(interstitialAd: ADInterstitialAd!) {
println("interstitialAdActionDidFinish")
interstitialAdView.removeFromSuperview()
}
func interstitialAdActionShouldBegin(interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool {
println("interstitialAdActionShouldBegin")
return true
}
func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
println("interstitialAd")
}
func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
println("interstitialAdDidUnload")
interstitialAdView.removeFromSuperview()
}
}