Guest User

Untitled

a guest
Sep 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Now you are ready to add a banner view to your application. Select the header of the UIViewController you want to show the banner in. Import SOMABannerView.h.
  2. #import "SOMABannerView.h"
  3. Create a member of property to contain the banner view
  4. SOMABannerView *mBannerView;
  5. Now switch to the .m file of your UIViewController. You have to create and add the banner view in your viewDidLoad method for example:
  6. - (void)viewDidLoad {
  7. [super viewDidLoad];
  8. mBannerView = [[SOMABannerView alloc] initWithDimension:kSOMAAdDimensionDefault]; [mBannerView adSettings].adspaceId = 0; // Replace with your adspace id. [mBannerView adSettings].publisherId = 0; // Replace with your publisher id. [self.view addSubview:mBannerView];
  9. [mBannerView release];
  10. }
  11. The banner can be reloaded automatically. The best place to activate this are the viewWillAppear / viewWillDisappear methods.
  12. -(void)viewWillAppear:(BOOL)animated { [mBannerView setAutoReloadEnabled:YES]; [mBannerView asyncLoadNewBanner];
  13. }
  14. -(void)viewWillDisappear:(BOOL)animated {
  15. [mBannerView setAutoReloadEnabled:NO]; }
Add Comment
Please, Sign In to add comment