YMAAdSize

Objective-C

@interface YMAAdSize : NSObject

Swift

class YMAAdSize : NSObject

This class is responsible for the banner size.

  1. Properties
  2. size
  3. Methods
  4. +fixedSizeWithCGSize:
  5. +flexibleSizeWithCGSize:
  6. +stickySizeWithContainerWidth:

Properties

size

The initial size of the banner.

Note The actual size of the banner is determined when calling the -[YMAAdViewDelegate adViewDidLoad:] method of the YMAAdViewDelegate class.

Declaration

Objective-C

@property (nonatomic, readonly) CGSize size;

Swift

var size: CGSize { get }

Methods

+fixedSizeWithCGSize:

Deprecated

Use flexibleSizeWithCGSize: or stickySizeWithContainerWidth: instead of fixedSizeWithCGSize:. Fixed YMAAdSize API will be removed starting from version 6.*

Creates an object of the YMAAdSize class with the specified maximum height and width of the banner.

Declaration

Objective-C

+ (nonnull instancetype)fixedSizeWithCGSize:(CGSize)size;

Swift

class func fixedSize(with size: CGSize) -> Self

Parameters

size

Maximum size available for a banner.

size

Maximum size available for a banner.

Return Value

An object of the YMAAdSize class with the fixed size.

+flexibleSizeWithCGSize:

Creates an object of the YMAAdSize class with the specified maximum height and width of the banner.

Warning

If the actual size of the banner is less than the size of the container, an adaptive layer is drawn under the banner.

Declaration

Objective-C

+ (nonnull instancetype)flexibleSizeWithCGSize:(CGSize)size;

Swift

class func flexibleSize(with size: CGSize) -> Self

Parameters

size

Maximum size available for a banner.

size

Maximum size available for a banner.

Return Value

An object of the YMAAdSize class with the specified maximum size of the banner.

+stickySizeWithContainerWidth:

Creates an object of the YMAAdSize class with the specified width of a sticky banner.

Declaration

Objective-C

+ (nonnull instancetype)stickySizeWithContainerWidth:(CGFloat)width;

Swift

class func stickySize(withContainerWidth width: CGFloat) -> Self

Parameters

width

Width of the banner.

width

Width of the banner.

Return Value

An object of the YMAAdSize class with the specified width of a sticky banner.