TDBannerView Class Reference

Inherits from UIView
Declared in TDBannerView.h

Overview

The TDBannerView class represents a view that displays Triton Banners (in-stream ads) ads.

The ads are represented by a TDAd object obtained from TDAdLoader. The banner size is independent of its frame size, but when initializing the TDBannerView with one of its initializers, it will make the underlying views size match the banner’s size.

Managing the delegate

  delegate

The delegate that will receive state changes from TDBannerView.

@property (nonatomic, weak) id<TDBannerViewDelegate> delegate

Declared In

TDBannerView.h

Creating a TDBannerView

– initWithWidth:andHeight:

Initializes a TDBannerView with specified widht and height positioned at the top left corner of its superview (0,0).

- (instancetype)initWithWidth:(NSInteger)width andHeight:(NSInteger)height

Parameters

width

The width of the banner

height

The height of the banner

Declared In

TDBannerView.h

– initWithWidth:andHeight:andFallbackWidth:andFallbackHeight:

Initializes a TDBannerView with origin (0,0) with specified widht and height in addition to fallback width and height.

- (instancetype)initWithWidth:(NSInteger)width andHeight:(NSInteger)height andFallbackWidth:(NSInteger)fallbackWidth andFallbackHeight:(NSInteger)fallbackHeight

Parameters

width

The width of the banner

height

The height of the banner

fallbackWidth

The fallback width of the banner

fallbackHeight

The fallback height of the banner

Discussion

The fallback size must be smaller than the main size otherwise it won’t fit inside the view. This feature was added in order to easily support 320x50 and 300x50 in the same view. The view won’t change it’s size, the fallback view will be centralized inside it.

Declared In

TDBannerView.h

– initWithWidth:andHeight:andFallbackWidth:andFallbackHeight:andOrigin:

Initializes a TDBannerView at the specified origin with specified widht and height in addition to fallback width and height. This is the designated initializer.

- (instancetype)initWithWidth:(NSInteger)width andHeight:(NSInteger)height andFallbackWidth:(NSInteger)fallbackWidth andFallbackHeight:(NSInteger)fallbackHeight andOrigin:(CGPoint)origin

Parameters

width

The width of the banner

height

The height of the banner

fallbackWidth

The fallback width of the banner

fallbackHeight

The fallback height of the banner

origin

a CGPoint with the top left position in points related to its superview

Discussion

The fallback size must be smaller than the main size otherwise it won’t fit inside the view. This feature was added in order to easily support 320x50 and 300x50 in the same view. The view won’t change it’s size, the fallback view will be centralized inside it.

Declared In

TDBannerView.h

Configuring size and position

  width

The width supported by the banner.

@property (assign, readonly) NSInteger width

Declared In

TDBannerView.h

  height

The height supported by the banner.

@property (assign, readonly) NSInteger height

Declared In

TDBannerView.h

  fallbackWidth

The fallback width supported by the banner.

@property (assign, readonly) NSInteger fallbackWidth

Declared In

TDBannerView.h

  fallbackHeight

The fallback height supported by the banner.

@property (assign, readonly) NSInteger fallbackHeight

Declared In

TDBannerView.h

– setWidth:andHeight:

Sets the width and height supported by the banner. These dimensions are indepentent of the banner frame size.

- (void)setWidth:(NSInteger)width andHeight:(NSInteger)height

Parameters

width

The width of the banner

height

The height of the banner

Declared In

TDBannerView.h

– setFallbackWidth:andHeight:

Sets the fallback width and height supported by the banner. The fallback size, when set, will be used in case the main size is not available. It will be centralized inside the banner.

- (void)setFallbackWidth:(NSInteger)fallbackWidth andHeight:(NSInteger)fallbackHeight

Parameters

fallbackWidth

The fallback width of the banner

fallbackHeight

The fallback height of the banner

Declared In

TDBannerView.h

– setOrigin:

Changes the top left position of the banner view related to its superview

- (void)setOrigin:(CGPoint)origin

Parameters

origin

a CGPoint with the new top left position in points related to its superview

Declared In

TDBannerView.h

Presenting and removing an ad

– presentAd:

Request an ad to be displayed in the view.

- (void)presentAd:(TDAd *)ad

Parameters

ad

the TDAd object with the ad information to be loaded. Loading with a nil object will clear the banner’s content.

Declared In

TDBannerView.h

– clear

Clears the banner contents

- (void)clear

Declared In

TDBannerView.h