Focus mode

Banner / MREC

Available banner ad sizes:

Banner SizeDescriptionDevicesAdSize constant
320x50BannerPhone and TabletTappxBannerSize320x50
728X90BannerTabletsTappxBannerSize728x90
-Smart BannerPhone and TabletTappxBannerSmartBanner
300x250IAB Medium RectanglePhone and TabletTappxBannerSize300x250

Setup TappxBannerView

To set up a banner ad, add the following lines to the ViewController: 

#import <TappxFramework/TappxAds.h>

@interface ViewController () <TappxBannerViewDelegate>
   @property (retain, nonatomic) TappxBannerView* tappxBanner;
@end

@implementation ViewController

- (void)viewDidLoad {
   [super viewDidLoad];
  _tappxBanner = [[TappxBannerView alloc] initWithDelegate:self
  andSize:TappxBannerSmartBanner];
  [self.addTappxBannerViewToView: _tappxBanner];
  [_tappxBanner setRootViewController:self];
  [_tappxBanner load];
}

- (void)addTappxBannerViewToView:(UIView *)tappxView {
    tappxView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:tappxView];
    [self.view addConstraints:@[
        [NSLayoutConstraint constraintWithItem:tappxView
                                     attribute:NSLayoutAttributeBottom
                                     relatedBy:NSLayoutRelationEqual
                                        toItem:self.view.safeAreaLayoutGuide
                                     attribute:NSLayoutAttributeBottom
                                    multiplier:1
                                      constant:0],
        [NSLayoutConstraint constraintWithItem:tappxView
                                     attribute:NSLayoutAttributeCenterX
                                     relatedBy:NSLayoutRelationEqual
                                        toItem:self.view
                                     attribute:NSLayoutAttributeCenterX
                                    multiplier:1
                                      constant:0]
    ]];
}
@end
import UIKit
import TappxFramework

class ViewController: UIViewController
{
   var tappxBanner: TappxBannerView?
   override func viewDidLoad() {
       super.viewDidLoad()
       self.tappxBanner = TappxBannerView(delegate: self, size: .smartBanner,position:.bottom)
       self.addTappxBannerViewToView(tappxView: self.tappxBanner!)
       self.tappxBanner?.setRootViewController(rootViewController: self)
       self.tappxBanner?.load()
   }

   func addTappxBannerViewToView(tappxView: UIView) {
        tappxView.translatesAutoresizingMaskIntoConstraints = false;
        self.view.addSubview(tappxView)
        self.view.addConstraints(
            [
                NSLayoutConstraint.init(item: tappxView, attribute: .bottom, relatedBy: .equal, toItem: self.view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0),
                NSLayoutConstraint.init(item: tappxView, attribute: .centerX, relatedBy: .equal, toItem: self.view, attribute: .centerX, multiplier: 1, constant: 0)
            ]
        )
    }
}
import SwiftUI
import TappxFramework

struct BannerAdTappxView: View {
    let navigationTitle: String
    var body: some View {
        VStack {
            UITappxBannerView(size: .size320x50, animation: .random){
                event in
                switch event {
                case .didClose(bannerView: let bannerView):
                    debugPrint("didClose \(bannerView)")
                    break
                case .didPress(bannerView: let bannerView):
                    debugPrint("didPress: \(bannerView)")
                    break
                case .didFinishLoad(bannerView: let bannerView):
                    debugPrint("didFinishLoad \(bannerView)")
                    break
                case .didFail(bannerView: let bannerView, error: let error):
                    debugPrint("didFail \(bannerView) with error: \(error)")
                    break
                }
            }
        }
    }
}

#Preview {
    BannerAdTappxView(navigationTitle: "Banner")
}

TIP: we recommend sending additional information with your ad requests to improve performance. Check Advanced Settings section.

Set delegates

-(void) tappxBannerViewDidFinishLoad:(TappxBannerView*) vc{
   NSLog(@"BANNER: DidFinishLoad");
}

-(void) tappxBannerViewDidFail:(TappxBannerView) viewController
withError:(TappxErrorAd) error{
   NSLog(@"BANNER: DidFail %@", error.descriptionError);
}

-(void) tappxBannerViewDidPress:(TappxBannerView*) vc{
   NSLog(@"BANNER: DidPressr");
}

-(void) tappxBannerViewDidClose:(TappxBannerView*) vc{
   NSLog(@"BANNER: DidClose");
}
extension AdViewController: TappxBannerViewDelegate {
  func tappxBannerViewDidFinishLoad(_vc: TappxBannerView!) {
     print("BANNER: FinishLoad")
  }
  func tappxBannerViewDidFail(_vc: TappxBannerView!, withError error: Error!) {
     print("BANNER: Failed %@", error.localizedDescription)
  }
  func tappxBannerViewDidPress(_vc: TappxBannerView!) {
     print("BANNER: DidPress")
  }
  func tappxBannerViewDidClose(_vc: TappxBannerView!) {
     print("BANNER: DidClose")
  }
}

Destroy TappxBannerView (Recommended)

After ad was successful shown and no longer needed, it can be destroyed.

if(_tappxBanner != nil)
{
   [_tappxBanner removeBanner];
   [_tappxBanner removeFromSuperview];
   _tappxBanner = nil;
}
if self.tappxBanner != nil {
  self.tappxBanner?.removeBanner()
  self.tappxBanner?.removeFromSuperview()
  self.tappxBanner = nil
}

Refreshing Ads

By default, banner ads periodically change every 30 seconds. To set the frequency of ad refresh use the following: 

[_tappxBanner setTimeRefresh:45];
self.tappxBanner?.setTimeRefresh(45)

The minimum refresh time is 30 seconds and the maximum is 150 seconds.

To disable automatic ad refresh, use:

[_tappxBanner disableRefresh];
self.tappxBanner?.disableRefresh()

Examples on GitHub

Banner ads example: Objective-C | Swift | SwiftUI

MREC ads example: Objective-C | Swift | SwiftUI

Complete demo: Objective-C | Swift | SwiftUI

Banner / MREC
×

Tappx logo white

Important Security Notice
Beware of scammers impersonating Tappx brand

We have identified fraudulent activities where malicious actors are imitating Tappx assets. These scams may compromise your security.

⚠️ Warning: The URL you came from has been flagged as potentially harmful. 

To stay safe, only trust communications and services from the official Tappx domain: tappx.com

×

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Etiam elit tortor, consequat sit amet ultricies ut, pellentesque a magna. Etiam mattis odio ut nibh pulvinar bibendum. Curabitur porta gravida urna sit amet tincidunt. Etiam sit amet nunc vulputate, blandit mauris sit amet, lacinia arcu. Morbi in orci tincidunt, tincidunt dolor vitae, hendrerit sem. Etiam in suscipit purus. Morbi dignissim vitae nibh ut condimentum.

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.