Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- #import "SOMABannerView.h"
- Create a member of property to contain the banner view
- SOMABannerView *mBannerView;
- Now switch to the .m file of your UIViewController. You have to create and add the banner view in your viewDidLoad method for example:
- - (void)viewDidLoad {
- [super viewDidLoad];
- 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];
- [mBannerView release];
- }
- The banner can be reloaded automatically. The best place to activate this are the viewWillAppear / viewWillDisappear methods.
- -(void)viewWillAppear:(BOOL)animated { [mBannerView setAutoReloadEnabled:YES]; [mBannerView asyncLoadNewBanner];
- }
- -(void)viewWillDisappear:(BOOL)animated {
- [mBannerView setAutoReloadEnabled:NO]; }
Add Comment
Please, Sign In to add comment