Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DetailController: UIViewController, GADInterstitialDelegate {
- //Admob
- ...
- ...
- var fullScreenAds : GADInterstitial!
- //Interstitial-Ad
- func createAndLoadInterstitial() -> GADInterstitial? {
- fullScreenAds = GADInterstitial(adUnitID: myInterstitialID)
- guard let fullScreenAds = fullScreenAds else {
- return nil
- }
- let request = GADRequest()
- request.testDevices = [ kGADSimulatorID ]
- fullScreenAds.load(request)
- fullScreenAds.delegate = self
- return fullScreenAds
- }
- func interstitialDidReceiveAd(_ ad: GADInterstitial) {
- print("Ads loaded.")
- ad.present(fromRootViewController: self)
- }
- func interstitialDidFail(toPresentScreen ad: GADInterstitial) {
- print("Ads not loaded.")
- }
- //MARK: View functions
- override func viewDidLoad() {
- super.viewDidLoad()
- ......
- SVProgressHUD.show()
- imageView.af_setImage(withURL: URL(string: pic.largeImageURL!)!, placeholderImage: imgPlaceHolder, filter: nil, progress: nil, progressQueue: DispatchQueue.main, imageTransition: .crossDissolve(0.2), runImageTransitionIfCached: true) { (data) in
- SVProgressHUD.dismiss()
- }
- scrollView.delegate = self
- setupScrollView()
- setupGestureRecognizers()
- setupBanner()
- self.fullScreenAds = createAndLoadInterstitial()
- }
- }
Add Comment
Please, Sign In to add comment