GADUBanner.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Copyright 2014 Google Inc. All Rights Reserved.
  2. #import <Foundation/Foundation.h>
  3. #import <GoogleMobileAds/GoogleMobileAds.h>
  4. #import "GADUTypes.h"
  5. /// A wrapper around GADBannerView. Includes the ability to create GADBannerView objects, load them
  6. /// with ads, and listen for ad events.
  7. @interface GADUBanner : NSObject
  8. /// Initializes a GADUBanner with specified width and height, positioned at either the top or
  9. /// bottom of the screen.
  10. - (id)initWithBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
  11. adUnitID:(NSString *)adUnitID
  12. width:(CGFloat)width
  13. height:(CGFloat)height
  14. adPosition:(GADAdPosition)adPosition;
  15. /// Initializes a full-width GADUBanner, positioned at either the top or bottom of the screen.
  16. - (id)initWithSmartBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
  17. adUnitID:(NSString *)adUnitID
  18. adPosition:(GADAdPosition)adPosition;
  19. /// Initializes a GADUBanner with specified width and height at the specified point.
  20. - (id)initWithBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
  21. adUnitID:(NSString *)adUnitID
  22. width:(CGFloat)width
  23. height:(CGFloat)height
  24. customAdPosition:(CGPoint)customAdPosition;
  25. /// Initializes a full-width GADUBanner with specified width and height at the specified point.
  26. - (id)initWithSmartBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
  27. adUnitID:(NSString *)adUnitID
  28. customAdPosition:(CGPoint)customAdPosition;
  29. /// Initializes an adaptive GADUBanner, positioned at either the top or bottom of the screen.
  30. - (id)initWithAdaptiveBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
  31. adUnitID:(NSString *)adUnitID
  32. width:(NSInteger)width
  33. orientation:(GADUBannerOrientation)orientation
  34. adPosition:(GADAdPosition)adPosition;
  35. /// Initializes an adaptive GADUBanner with a custom position at given point from top left.
  36. - (id)initWithAdaptiveBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
  37. adUnitID:(NSString *)adUnitID
  38. width:(NSInteger)width
  39. orientation:(GADUBannerOrientation)orientation
  40. customAdPosition:(CGPoint)customAdPosition;
  41. /// A reference to the Unity banner client.
  42. @property(nonatomic, assign) GADUTypeBannerClientRef *bannerClient;
  43. /// A GADBannerView which contains the ad.
  44. @property(nonatomic, strong) GADBannerView *bannerView;
  45. /// The ad received callback into Unity.
  46. @property(nonatomic, assign) GADUAdViewDidReceiveAdCallback adReceivedCallback;
  47. /// The ad failed callback into Unity.
  48. @property(nonatomic, assign) GADUAdViewDidFailToReceiveAdWithErrorCallback adFailedCallback;
  49. /// The will present screen callback into Unity.
  50. @property(nonatomic, assign) GADUAdViewWillPresentScreenCallback willPresentCallback;
  51. /// The did dismiss screen callback into Unity.
  52. @property(nonatomic, assign) GADUAdViewDidDismissScreenCallback didDismissCallback;
  53. /// The will leave application callback into Unity.
  54. @property(nonatomic, assign) GADUAdViewWillLeaveApplicationCallback willLeaveCallback;
  55. /// The paid event callback into Unity.
  56. @property(nonatomic, assign) GADUAdViewPaidEventCallback paidEventCallback;
  57. // Returns the mediation adapter class name.
  58. @property(nonatomic, readonly, copy) NSString *mediationAdapterClassName;
  59. // Returns the banner ad response info.
  60. @property(nonatomic, readonly, copy) GADResponseInfo *responseInfo;
  61. // Returns the height of the banner view in pixels.
  62. @property(nonatomic, readonly) CGFloat heightInPixels;
  63. // Returns the width of the banner view in pixels.
  64. @property(nonatomic, readonly) CGFloat widthInPixels;
  65. /// Makes an ad request. Additional targeting options can be supplied with a request object.
  66. - (void)loadRequest:(GADRequest *)request;
  67. /// Makes the GADBannerView hidden on the screen.
  68. - (void)hideBannerView;
  69. /// Makes the GADBannerView visible on the screen.
  70. - (void)showBannerView;
  71. /// Removes the GADBannerView from the view hierarchy.
  72. - (void)removeBannerView;
  73. /// Set the GADBannerView's position on screen using a standard position.
  74. - (void)setAdPosition:(GADAdPosition)adPosition;
  75. /// Set the GADBannerView's position on screen using a custom position.
  76. - (void)setCustomAdPosition:(CGPoint)customPosition;
  77. @end