Banner
Prerequisites
Always test with test ads
63a573861ac5fCreate a Adx3BannerAdView
Interface Builder
Programmatically
class ViewController: UIViewController {
var bannerView : Adx3BannerAdView!
override func viewDidLoad() {
super.viewDidLoad()
self.addBannerView()
// Do any additional setup after loading the view.
}
func addBannerView() {
bannerView = Adx3BannerAdView.init(adSize: CGSize(width: 250, height: 150), delegate: self)
bannerView!.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(bannerView)
view.addConstraint(NSLayoutConstraint.init(item: bannerView!, attribute: .bottom, relatedBy: .equal, toItem: bottomLayoutGuide, attribute: .bottom, multiplier: 1.0, constant: 0.0))
view.addConstraint(NSLayoutConstraint.init(item: bannerView!, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1.0, constant: 0.0))
}
}#import "Adx3Framework/Adx3Ad.h"
@interface ViewController ()
@property (strong, nonatomic) Adx3BannerAdView *bannberView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self addBannerView];
}
- (void)addBannerView {
CGSize adSize = CGSizeMake(250, 150);
[self.bannberView removeFromSuperview];
self.bannberView = [[Adx3BannerAdView alloc] initWithAdSize:adSize delegate:self];
self.bannberView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.bannberView];
[self.view addConstraints:
@[[NSLayoutConstraint constraintWithItem:self.bannberView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0],
[NSLayoutConstraint constraintWithItem:self.bannberView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view.safeAreaLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]
]];
}
@endLoad an ad
Ad events
Last updated