Advanced Usage - Using banner delegates

View original article on our GitHub

Set your view controller as a delegate so it is able to receive callbacks from the banner ad.

  1. Add the STABannerDelegagteProtocol to the class declaration

    class ViewController: UIViewController, STABannerDelegagteProtocol
  2. Use withDelegate:self when initializing the STABannerView object:

    startAppBanner = STABannerView(size: STA_AutoAdSize, 
                               autoOrigin: STAAdOrigin_Bottom, 
                               withView: self.view, 
                               withDelegate: self);
  3. Implement the following functions:

    func didDisplayBannerAd(banner: STABannerView)
    func failedLoadBannerAd(banner: STABannerView,  withError error: NSError)    
    func didClickBannerAd(banner: STABannerView)
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request