Last active
August 29, 2015 14:22
-
-
Save ydn/481331cb095fa767ecd2 to your computer and use it in GitHub Desktop.
Full-Screen Ads (complete example) with Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController, FlurryAdInterstitialDelegate { | |
let adInterstitial = FlurryAdInterstitial(space:"ADSPACE"); | |
override func viewDidAppear(animated: Bool) { | |
super.viewDidAppear(animated); | |
adInterstitial.adDelegate = self; | |
adInterstitial.fetchAd(); | |
} | |
override func viewDidDisappear(animated: Bool) { | |
super.viewDidDisappear(animated); | |
} | |
/** | |
* Invoke an interstitials at a natural pause in your app. For example, when a | |
* level is completed, an article is read or a button is pressed. Here we | |
* mock the display of ant interstitials when a button is pressed. | |
*/ | |
@IBAction func showFullScreenAdClickedButton(sender: AnyObject) { | |
if adInterstitial.ready { | |
adInterstitial.presentWithViewController(self); | |
} else { | |
adInterstitial.fetchAd(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There should be no reason to test if
adInterstitial != nil
in the bottom method.