GoogleMobileAds Framework Reference

DFPBannerView

class DFPBannerView : GADBannerView

The view that displays Ad Manager banner ads.

To request this ad type using GADAdLoader, you need to pass kGADAdLoaderAdTypeDFPBanner (see GADAdLoaderAdTypes.h) to the |adTypes| parameter in GADAdLoader’s initializer method. If you request this ad type, your delegate must conform to the DFPBannerAdLoaderDelegate protocol.

  • Required value created on the Ad Manager website. Create a new ad unit for every unique placement of an ad in your application. Set this to the ID assigned for this placement. Ad units are important for targeting and statistics.

    Example Ad Manager ad unit ID: @/6499/example/banner

    Declaration

    Swift

    var adUnitID: String? { get set }
  • Optional delegate that is notified when creatives send app events.

    Declaration

    Swift

    @IBOutlet weak var appEventDelegate: GADAppEventDelegate? { get set }
  • Optional delegate that is notified when creatives cause the banner to change size.

    Declaration

    Swift

    @IBOutlet weak var adSizeDelegate: GADAdSizeDelegate? { get set }
  • Optional array of NSValue encoded GADAdSize structs, specifying all valid sizes that are appropriate for this slot. Never create your own GADAdSize directly. Use one of the predefined standard ad sizes (such as kGADAdSizeBanner), or create one using the GADAdSizeFromCGSize method.

    Example:

      NSArray *validSizes = @[
        NSValueFromGADAdSize(kGADAdSizeBanner),
        NSValueFromGADAdSize(kGADAdSizeLargeBanner)
      ];

    bannerView.validAdSizes = validSizes;

    Declaration

    Swift

    var validAdSizes: [NSValue]? { get set }
  • Correlator object for correlating this object to other ad objects.

    Declaration

    Swift

    var correlator: GADCorrelator? { get set }
  • Indicates that the publisher will record impressions manually when the ad becomes visible to the user.

    Declaration

    Swift

    var enableManualImpressions: Bool { get set }
  • Optional delegate object for custom rendered ads.

    Declaration

    Swift

    @IBOutlet weak var customRenderedBannerViewDelegate: DFPCustomRenderedBannerViewDelegate? { get set }
  • Video controller for controlling video rendered by this ad view.

    Declaration

    Swift

    var videoController: GADVideoController { get }
  • If you’ve set enableManualImpressions to YES, call this method when the ad is visible.

    Declaration

    Swift

    func recordImpression()
  • Use this function to resize the banner view without launching a new ad request.

    Declaration

    Swift

    func resize(_ size: GADAdSize)
  • Sets options that configure ad loading.

    Declaration

    Swift

    func setAdOptions(_ adOptions: [GADAdLoaderOptions])

    Parameters

    adOptions

    An array of GADAdLoaderOptions objects. The array is deep copied and option objects cannot be modified after calling this method.

  • Deprecated. Use the validAdSizes property. Sets the receiver’s valid ad sizes to the values pointed to by the provided NULL terminated list of GADAdSize pointers.

    Example:

      GADAdSize size1 = kGADAdSizeBanner;
      GADAdSize size2 = kGADAdSizeLargeBanner;
      [bannerView setValidAdSizesWithSizes:&size1, &size2, nil];