GADAdSize.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // GADAdSize.h
  3. // Google Mobile Ads SDK
  4. //
  5. // Copyright 2012 Google Inc. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import <UIKit/UIKit.h>
  9. #import "GoogleMobileAdsDefines.h"
  10. /// A valid GADAdSize is considered to be one of the predefined GADAdSize constants or a GADAdSize
  11. /// constructed by GADAdSizeFromCGSize, GADAdSizeFullWidthPortraitWithHeight,
  12. /// GADAdSizeFullWidthLandscapeWithHeight.
  13. ///
  14. /// Do not create a GADAdSize manually. Use one of the kGADAdSize constants. Treat GADAdSize as an
  15. /// opaque type. Do not access any fields directly. To obtain a concrete CGSize, use the function
  16. /// CGSizeFromGADAdSize().
  17. typedef struct GADAdSize {
  18. CGSize size;
  19. NSUInteger flags;
  20. } GADAdSize;
  21. #pragma mark Standard Sizes
  22. /// iPhone and iPod Touch ad size. Typically 320x50.
  23. GAD_EXTERN GADAdSize const kGADAdSizeBanner;
  24. /// Taller version of kGADAdSizeBanner. Typically 320x100.
  25. GAD_EXTERN GADAdSize const kGADAdSizeLargeBanner;
  26. /// Medium Rectangle size for the iPad (especially in a UISplitView's left pane). Typically 300x250.
  27. GAD_EXTERN GADAdSize const kGADAdSizeMediumRectangle;
  28. /// Full Banner size for the iPad (especially in a UIPopoverController or in
  29. /// UIModalPresentationFormSheet). Typically 468x60.
  30. GAD_EXTERN GADAdSize const kGADAdSizeFullBanner;
  31. /// Leaderboard size for the iPad. Typically 728x90.
  32. GAD_EXTERN GADAdSize const kGADAdSizeLeaderboard;
  33. /// Skyscraper size for the iPad. Mediation only. AdMob/Google does not offer this size. Typically
  34. /// 120x600.
  35. GAD_EXTERN GADAdSize const kGADAdSizeSkyscraper;
  36. /// An ad size that spans the full width of the application in portrait orientation. The height is
  37. /// typically 50 pixels on an iPhone/iPod UI, and 90 pixels tall on an iPad UI.
  38. GAD_EXTERN GADAdSize const kGADAdSizeSmartBannerPortrait;
  39. /// An ad size that spans the full width of the application in landscape orientation. The height is
  40. /// typically 32 pixels on an iPhone/iPod UI, and 90 pixels tall on an iPad UI.
  41. GAD_EXTERN GADAdSize const kGADAdSizeSmartBannerLandscape;
  42. /// An ad size that spans the full width of its container, with a height dynamically determined by
  43. /// the ad.
  44. GAD_EXTERN GADAdSize const kGADAdSizeFluid;
  45. /// Invalid ad size marker.
  46. GAD_EXTERN GADAdSize const kGADAdSizeInvalid;
  47. #pragma mark Custom Sizes
  48. /// Returns a custom GADAdSize for the provided CGSize. Use this only if you require a non-standard
  49. /// size. Otherwise, use one of the standard size constants above.
  50. GADAdSize GADAdSizeFromCGSize(CGSize size);
  51. /// Returns a custom GADAdSize that spans the full width of the application in portrait orientation
  52. /// with the height provided.
  53. GADAdSize GADAdSizeFullWidthPortraitWithHeight(CGFloat height);
  54. /// Returns a custom GADAdSize that spans the full width of the application in landscape orientation
  55. /// with the height provided.
  56. GADAdSize GADAdSizeFullWidthLandscapeWithHeight(CGFloat height);
  57. #pragma mark Convenience Functions
  58. /// Returns YES if the two GADAdSizes are equal, otherwise returns NO.
  59. BOOL GADAdSizeEqualToSize(GADAdSize size1, GADAdSize size2);
  60. /// Returns a CGSize for the provided a GADAdSize constant. If the GADAdSize is unknown, returns
  61. /// CGSizeZero.
  62. CGSize CGSizeFromGADAdSize(GADAdSize size);
  63. /// Returns YES if |size| is one of the predefined constants or is a custom GADAdSize generated by
  64. /// GADAdSizeFromCGSize.
  65. BOOL IsGADAdSizeValid(GADAdSize size);
  66. /// Returns a NSString describing the provided GADAdSize.
  67. NSString *NSStringFromGADAdSize(GADAdSize size);
  68. /// Returns an NSValue representing the GADAdSize.
  69. NSValue *NSValueFromGADAdSize(GADAdSize size);
  70. /// Returns a GADAdSize from an NSValue. Returns kGADAdSizeInvalid if the value is not a GADAdSize.
  71. GADAdSize GADAdSizeFromNSValue(NSValue *value);
  72. #pragma mark Deprecated Macros
  73. #define GAD_SIZE_320x50 CGSizeFromGADAdSize(kGADAdSizeBanner)
  74. #define GAD_SIZE_320x100 CGSizeFromGADAdSize(kGADAdSizeLargeBanner)
  75. #define GAD_SIZE_300x250 CGSizeFromGADAdSize(kGADAdSizeMediumRectangle)
  76. #define GAD_SIZE_468x60 CGSizeFromGADAdSize(kGADAdSizeFullBanner)
  77. #define GAD_SIZE_728x90 CGSizeFromGADAdSize(kGADAdSizeLeaderboard)
  78. #define GAD_SIZE_120x600 CGSizeFromGADAdSize(kGADAdSizeSkyscraper)