Follow

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 STABannerDelegateProtocol to the header file

    @interface YourViewController : UIViewController <STABannerDelegateProtocol>
    {
       STABannerView* bannerView;  
    } 
  2. Use "withDelegate:self" when initializing the STABannerView object:

    bannerView = [[STABannerView alloc] initWithSize:STA_AutoAdSize 
                                        autoOrigin:STAAdOrigin_Top                 
                                        withView:self.view 
                                        withDelegate:self];
  3. Implement the following functions:

    - (void) didDisplayBannerAd:(STABannerView*)banner;
    - (void) failedLoadBannerAd:(STABannerView*)banner withError:(NSError *)error;
    - (void) didClickBannerAd:(STABannerView*)banner;

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments