daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class DetailController: UIViewController, GADInterstitialDelegate {
  2.  
  3.     //Admob
  4.     ...
  5.     ...
  6.     var fullScreenAds : GADInterstitial!
  7.  
  8.     //Interstitial-Ad
  9.     func createAndLoadInterstitial() -> GADInterstitial? {
  10.         fullScreenAds = GADInterstitial(adUnitID: myInterstitialID)
  11.         guard let fullScreenAds = fullScreenAds else {
  12.             return nil
  13.         }
  14.         let request = GADRequest()
  15.         request.testDevices = [ kGADSimulatorID ]
  16.         fullScreenAds.load(request)
  17.         fullScreenAds.delegate = self
  18.  
  19.         return fullScreenAds
  20.     }
  21.  
  22.     func interstitialDidReceiveAd(_ ad: GADInterstitial) {
  23.         print("Ads loaded.")
  24.         ad.present(fromRootViewController: self)
  25.     }
  26.  
  27.     func interstitialDidFail(toPresentScreen ad: GADInterstitial) {
  28.         print("Ads not loaded.")
  29.     }
  30.  
  31.     //MARK: View functions
  32.     override func viewDidLoad() {
  33.         super.viewDidLoad()
  34.  
  35.         ......
  36.  
  37.         SVProgressHUD.show()
  38.         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
  39.             SVProgressHUD.dismiss()
  40.         }
  41.  
  42.         scrollView.delegate = self
  43.         setupScrollView()
  44.         setupGestureRecognizers()
  45.         setupBanner()
  46.  
  47.         self.fullScreenAds = createAndLoadInterstitial()
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top