GADAdSize.h 3.6 KB

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