YMAAdView

Objective-C

@interface YMAAdView : UIView

Swift

class YMAAdView : UIView

This class is responsible for setting up and displaying banners.

  1. Properties
  2. delegate
  3. adUnitID
  4. videoController
  5. Methods
  6. -initWithAdUnitID:adSize:
  7. -displayAtTopInView:
  8. -displayAtBottomInView:
  9. -loadAd
  10. -loadAdWithRequest:
  11. -adContentSize

Properties

delegate

An object that implements the YMAAdViewDelegate protocol that tracks the ad and receives notifications about user interaction with the ad. It provides data necessary for displaying the ad (for example, a UIViewController object that AdView uses to show a modal controller in response to the user interacting with the banner).

Declaration

Objective-C

@property (nonatomic, weak, nullable) id<YMAAdViewDelegate> delegate;

Swift

weak var delegate: YMAAdViewDelegate? { get set }

adUnitID

AdUnit ID is a unique identifier that is issued in the Partner interface and has the format R-M-XXXXXX-Y.

Declaration

Objective-C

@property (nonatomic, copy, readonly) NSString *_Nonnull adUnitID;

Swift

var adUnitID: String { get }

videoController

An object of the YMAVideoController class, which manages the video content in an ad.

Declaration

Objective-C

@property (nonatomic, strong, readonly) YMAVideoController *_Nonnull videoController;

Swift

var videoController: YMAVideoController { get }

Methods

-initWithAdUnitID:adSize:

Initializes an object of the YMAAdView class to display the banner with the specified size.

Declaration

Objective-C

- (nonnull instancetype)initWithAdUnitID:(nonnull NSString *)adUnitID
                                  adSize:(nonnull YMAAdSize *)adSize;

Swift

init(adUnitID: String, adSize: YMAAdSize)

Parameters

adUnitID

AdUnit ID is a unique identifier that is issued in the Partner interface and has the format R-M-XXXXXX-Y.

adSize

The size of the banner. The size of the banner is set in the YMAAdSize class.

adUnitID

AdUnit ID is a unique identifier that is issued in the Partner interface and has the format R-M-XXXXXX-Y.

adSize

The size of the banner. The size of the banner is set in the YMAAdSize class.

Return Value

Initializes an object of the YMAAdView class to display the banner with the specified size.

-displayAtTopInView:

Displays the banner centered at the top of the passed View.

Declaration

Objective-C

- (void)displayAtTopInView:(nonnull UIView *)view;

Swift

func displayAtTop(in view: UIView)

Parameters

view

An object of the UIView class to add the banner to.

view

An object of the UIView class to add the banner to.

-displayAtBottomInView:

Displays the banner centered at the bottom of the passed View.

Declaration

Objective-C

- (void)displayAtBottomInView:(nonnull UIView *)view;

Swift

func displayAtBottom(in view: UIView)

Parameters

view

An object of the UIView class to add the banner to.

view

An object of the UIView class to add the banner to.

-loadAd

Loads a banner.

Declaration

Objective-C

- (void)loadAd;

Swift

func loadAd()

-loadAdWithRequest:

Loads a banner with data for targeting.

Declaration

Objective-C

- (void)loadAdWithRequest:(nullable YMAAdRequest *)request;

Swift

func loadAd(with request: YMAAdRequest?)

Parameters

request

Data for targeting (YMAAdRequest).

request

Data for targeting (YMAAdRequest).

-adContentSize

Returns the size of the banner content.

Declaration

Objective-C

- (CGSize)adContentSize;

Swift

func adContentSize() -> CGSize

Return Value

The size of the banner content.