9

I am buildung my very first application with Admob banners in Xcode. My apps uses multiple UIViews connect via NavigationController and currently I am requesting a new ad for every UIView.

That is what I already got for every UIViewController:

import GoogleMobileAds

class ViewController: UIViewController {

    @IBOutlet weak var bannerView: GADBannerView!

    override func viewDidLoad() {
        super.viewDidLoad()
        bannerView.adUnitID = "ca-app-pub-281379xxxxx/64134xxxxx"
        bannerView.rootViewController = self
        bannerView.loadRequest(GADRequest())
    }
}

How can I implement a "shared" banner for all views which gets managed from a separate class or by the AppDelegate. (All of my views got an GADBannerView at the bottom already.)

I never really worked with delegate methods before, because coding is just hobby from me and I am learning like: Try & Error. But at this point my skills aren't good enough to realize this.

I would appreciate any kind of help :-). Thank you!

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
Benjamin1956
  • 1,883
  • 2
  • 12
  • 12

0 Answers0