BannerAdSize

@objc(YMABannerAdSize)
public class BannerAdSize : NSObject

This class is responsible for the banner size.

  • The initial size of the banner.

    Remark

    The actual size of the banner is determined when calling the AdViewDelegate.adViewDidLoad: method of the AdViewDelegate class.

    Declaration

    Swift

    @objc
    public var size: CGSize { get }
  • Creates an object of the BannerAdSize class with the specified width and height of the banner. The method is intended for use in Third-Party Mediation. For receiving an adaptive anchor banner located at the top or bottom of the screen use stickySize(withContainerWidth:), for banner in the feed use inlineSize(withWidth:maxHeight:).

    Declaration

    Swift

    @objc(fixedSizeWithWidth:height:)
    public static func fixedSize(withWidth width: CGFloat, height: CGFloat) -> BannerAdSize

    Parameters

    width

    Width of the banner.

    height

    Height of the banner.

    Return Value

    An object of the BannerAdSize class with the fixed size.

  • Creates an object of the BannerAdSize 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

    Swift

    @objc(inlineSizeWithWidth:maxHeight:)
    public static func inlineSize(withWidth width: CGFloat, maxHeight height: CGFloat) -> BannerAdSize

    Parameters

    width

    Width of the banner.

    height

    Maximum height available for an adaptive banner.

    Return Value

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

  • Creates an object of the BannerAdSize class with the specified width of the banner.

    Remark

    Returns sticky banner size with the given width.

    Declaration

    Swift

    @objc(stickySizeWithContainerWidth:)
    public static func stickySize(withContainerWidth width: CGFloat) -> BannerAdSize

    Parameters

    width

    Width of the banner.

    Return Value

    An object of the BannerAdSize class with the specified width of the sticky banner