Banner

Before You Start

Before integrating ads unit in your app, you must:

  • In the AdTiming UI, create an account, create an app, and create an ad placement using the format 'Rewarded Video'. You can follow guides here.
  • Follow our steps to iOS SDK Integration by integrating the AdTiming SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad networks' SDKs and the corresponding adapters you wish to work with in your app.

Banner

Banners are rectangular, system-initiated ads that served in a designated area around your live app content.

Step 1. Initialize Banner Ad

The AdTiming SDK fires several events to inform you of Banner Ad activity. To display Banner Ads, one needs to create a brand new AdTimingBanner object, set up its Delegate and load the ads.

Create AdTimingBanner Object

The following snippet demonstrates how to use the AdTimingBanner class to create Banner objects and implement the AdTimingBannerDelegate interface to receive Banner Ad events. The SDK will notify the Delegate of all possible events listed below:

@property (nonatomic, strong) AdTimingBanner *banner;
- (AdTimingBanner*)banner{
     if(!_banner){
         _banner = [[AdTimingBanner alloc] initWithBannerType:AdTimingBannerTypeDefault placementID:@"YOUR_PLACEMENT_ID"];
         [_banner addLayoutAttribute:AdTimingBannerLayoutAttributeHorizontally constant:0];
         [_banner addLayoutAttribute:AdTimingBannerLayoutAttributeVertically constant:0];
         _banner.delegate = self;
         [self.view addSubview:_banner];
     }
   return _banner;
}
private lazy var banner: AdTimingBanner = {
let banner = AdTimingBanner(bannerType: AdTimingBannerType.default, placementID: "YOUR_PLACEMENT_ID")
banner.add(.horizontally, constant: 0)
banner.add(.vertically, constant: 0)
banner.delegate = self
self.view.addSubview(banner)
return banner
}()

See table below for details about our supported standard banner sizes:

AdTimingBannerType Size
AdTimingBannerTypeDefault 320 x 50
AdTimingBannerTypeMediumRectangle 300 x 250
AdTimingBannerTypeLeaderboard 728 x 90
AdTimingBannerTypeSmart If (iPhone) 320 x 50
If (iPad) 728 x 90

 

Banner Delegate (AdTimingBannerDelegate)

Implement the following callback functions in your code to process ad logic when receiving the status of your ad. For example invoke loadAndShow function to serve Ad to your users when the Banner Ad is ready.  

The methods declared by the AdTimingBannerDelegate protocol allow the adopting delegate to respond to messages from the AdTimingBanner class and thus respond to operations such as whether the ad has been loaded, or the user has clicked the ad. 

/// Invoked when the banner ad is available.
- (void)adtimingBannerDidLoad:(AdTimingBanner *)banner {
     NSLog(@"BannerAd Did Load");
}

/// Invoked when the call to load a banner has failed.
/// Parameter error contains the reason for the failure.
- (void)adtimingBannerDidFailToLoad:(AdTimingBanner *)banner withError:(NSError *)error {
     NSLog(@"BannerAd Did Fail");
}

/// Invoked when the banner ad is showing.
- (void)adtimingBannerWillExposure:(AdTimingBanner *)banner {
     NSLog(@"BannerAd Will Exposure");
}

/// Invoked when the user clicks on the banner ad.
- (void)adtimingBannerDidClick:(AdTimingBanner *)banner {
     NSLog(@"BannerAd Did Click");
}
/// Invoked when the banner ad is available.
func adtimingBannerDidLoad:(_ banner: AdTimingBanner) {
     print(@"BannerAd Did Load")
}

/// Invoked when the call to load a banner has failed.
/// Parameter error contains the reason for the failure.
func adtimingBannerDidFail:(toLoad banner: AdTimingBanner, withError error: Error) {
     print(@"BannerAd Did Fail")
}

/// Invoked when the banner ad is showing.
func adtimingBannerWillExposure:(_ banner: AdTimingBanner) {
     print(@"BannerAd Will Exposure")
}

/// Invoked when the user clicks on the banner ad.
func adtimingBannerDidClick(_ banner: AdTimingBanner) {
     print(@"BannerAd Did Click")
}

 

Step 2. Load and Show a Banner Ad

Invoke loadAndShow method to request and show the Banner Ad to your users.

[self.banner loadAndShow];
self.banner.loadAndShow()

Notes: The loadAndShow method can be called multiple times at any time, but we do not recommend continuous requests within a short period of time. Making many requests in a short period of time makes no sense because the inventory's availability is unlikely to change much over this period. 

Please do not request Banner ads regularly in the application, AdTiming SDK will automatically refresh Banner ads regularly.

 

Step 3. Safe Area Layout Implementation

Safe area refers to the layout guides introduced as part of iOS11, defining the allowed position views in iOS applications. It makes sure that your application will not cover any ancestor views, including navigation and tab bars.

if (@available(iOS 11.0, *)) {
    [_banner setCenter:CGPointMake(self.view.center.x, self.view.frame.size.height - _banner.frame.size.height/2.0 - self.view.safeAreaInsets.bottom)];
 } else {
    [_banner setCenter:CGPointMake(self.view.center.x, self.view.frame.size.height - _banner.frame.size.height/2.0)];
 }
if #available(iOS 11.0, *) {
    banner.center = CGPoint.init(x:self.view.center.x, y:self.view.frame.size.height - banner.frame.size.height/2.0 - self.view.safeAreaInsets.bottom)
 } else {
    banner.center = CGPoint.init(x:self.view.center.x, y:self.view.frame.size.height - banner.frame.size.height/2.0)
 }

 

Step 4. Integrate a Banner Provider

You can find the supported networks below, and bannerSize behaviour for each network below:  

Platforms

Default

(320*50)

Rectangle

(300*250)

Leaderboard

(728*90)

Smart

(320*50/728*90)

Admob ✔️ ✔️ ✔️ ✔️
Facebook ✔️ ✔️ ✔️ ✔️
AdColony ✔️ ✔️ ✔️ ✔️
UnityAds ✔️   ✔️ ✔️
Vungle ✔️   ✔️ ✔️
AppLovin ✔️ ✔️ ✔️ ✔️
Pangle ✔️ ✔️ ✔️ ✔️
Mintegral ✔️ ✔️ ✔️ ✔️
TencentAds ✔️   ✔️ ✔️
IronSource ✔️ ✔️ ✔️ ✔️
MoPub ✔️ ✔️ ✔️ ✔️

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.