GoogleMobileAds Framework Reference

  • GADNativeAdView is the base class for creating native ad views, requiring subclassing and calling superclass methods.

  • It provides properties to link the ad view with the native ad object and various asset views like headline, icon, and body.

  • Developers can connect UI elements to specific ad assets using properties like headlineView, iconView, and callToActionView.

  • The mediaView property allows integration with GADMediaView for displaying media content within the ad.

  • adChoicesView should be set before nativeAd for custom positioning, otherwise default positioning from GADNativeAdViewAdOptions is used.

GADNativeAdView


@interface GADNativeAdView : UIView

Base class for native ad views. Your native ad view must be a subclass of this class and must call superclass methods for all overridden methods.

  • This property must point to the native ad object rendered by this ad view.

    Declaration

    Swift

    var nativeAd: NativeAd? { get set }

    Objective-C

    @property (nonatomic, strong, nullable) GADNativeAd *nativeAd;
  • Weak reference to your ad view’s headline asset view.

    Declaration

    Swift

    @IBOutlet weak var headlineView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *headlineView;
  • Weak reference to your ad view’s call to action asset view.

    Declaration

    Swift

    @IBOutlet weak var callToActionView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *callToActionView;
  • Weak reference to your ad view’s icon asset view.

    Declaration

    Swift

    @IBOutlet weak var iconView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *iconView;
  • Weak reference to your ad view’s body asset view.

    Declaration

    Swift

    @IBOutlet weak var bodyView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *bodyView;
  • Weak reference to your ad view’s store asset view.

    Declaration

    Swift

    @IBOutlet weak var storeView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *storeView;
  • Weak reference to your ad view’s price asset view.

    Declaration

    Swift

    @IBOutlet weak var priceView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *priceView;
  • Weak reference to your ad view’s image asset view.

    Declaration

    Swift

    @IBOutlet weak var imageView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *imageView;
  • Weak reference to your ad view’s star rating asset view.

    Declaration

    Swift

    @IBOutlet weak var starRatingView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *starRatingView;
  • Weak reference to your ad view’s advertiser asset view.

    Declaration

    Swift

    @IBOutlet weak var advertiserView: UIView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIView *advertiserView;
  • Weak reference to your ad view’s media asset view.

    Declaration

    Swift

    @IBOutlet weak var mediaView: MediaView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) GADMediaView *mediaView;
  • Weak reference to your ad view’s AdChoices view. Must set adChoicesView before setting nativeAd, otherwise AdChoices will be rendered according to the preferredAdChoicesPosition defined in GADNativeAdViewAdOptions.

    Declaration

    Swift

    @IBOutlet weak var adChoicesView: AdChoicesView? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) GADAdChoicesView *adChoicesView;