GADNativeCustomTemplateAd.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // GADNativeCustomTemplateAd.h
  3. // Google Mobile Ads SDK
  4. //
  5. // Copyright 2015 Google Inc. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import <UIKit/UIKit.h>
  9. #import "GADAdLoaderDelegate.h"
  10. #import "GADNativeAd.h"
  11. #import "GADNativeAdImage.h"
  12. #import "GoogleMobileAdsDefines.h"
  13. /// For use with GADAdLoader's creation methods. If you request this ad type, your delegate must
  14. /// conform to the GADNativeCustomTemplateAdLoaderDelegate protocol.
  15. GAD_EXTERN NSString *const kGADAdLoaderAdTypeNativeCustomTemplate;
  16. /// Native custom template ad.
  17. @interface GADNativeCustomTemplateAd : GADNativeAd
  18. /// The ad's custom template ID.
  19. @property(nonatomic, readonly) NSString *templateID;
  20. /// Array of available asset keys.
  21. @property(nonatomic, readonly) NSArray *availableAssetKeys;
  22. /// Returns the native ad image corresponding to the specified key or nil if the image is not
  23. /// available.
  24. - (GADNativeAdImage *)imageForKey:(NSString *)key;
  25. /// Returns the string corresponding to the specified key or nil if the string is not available.
  26. - (NSString *)stringForKey:(NSString *)key;
  27. /// Call when the user clicks on the ad. Provide the asset key that best matches the asset the user
  28. /// interacted with. Provide |customClickHandler| only if this template is configured with a custom
  29. /// click action, otherwise pass in nil. If a block is provided, the ad's built-in click actions are
  30. /// ignored and |customClickHandler| is executed after recording the click.
  31. - (void)performClickOnAssetWithKey:(NSString *)assetKey
  32. customClickHandler:(dispatch_block_t)customClickHandler;
  33. /// Call when the ad is displayed on screen to the user. Can be called multiple times. Only the
  34. /// first impression is recorded.
  35. - (void)recordImpression;
  36. @end
  37. #pragma mark - Loading Protocol
  38. /// The delegate of a GADAdLoader object implements this protocol to receive
  39. /// GADNativeCustomTemplateAd ads.
  40. @protocol GADNativeCustomTemplateAdLoaderDelegate<GADAdLoaderDelegate>
  41. /// Called when requesting an ad. Asks the delgate for an array of custom template ID strings.
  42. - (NSArray *)nativeCustomTemplateIDsForAdLoader:(GADAdLoader *)adLoader;
  43. /// Tells the delegate that a native custom template ad was received.
  44. - (void)adLoader:(GADAdLoader *)adLoader
  45. didReceiveNativeCustomTemplateAd:(GADNativeCustomTemplateAd *)nativeCustomTemplateAd;
  46. @end