commit | author | age
|
96fe76
|
1 |
// |
L |
2 |
// GADAdSize.h |
|
3 |
// Google Mobile Ads SDK |
|
4 |
// |
|
5 |
// Copyright 2012 Google LLC. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <Foundation/Foundation.h> |
|
9 |
#import <GoogleMobileAds/GoogleMobileAdsDefines.h> |
|
10 |
#import <UIKit/UIKit.h> |
|
11 |
|
|
12 |
/// A valid GADAdSize is considered to be one of the predefined GADAdSize constants or a GADAdSize |
|
13 |
/// constructed by GADAdSizeFromCGSize, GADAdSizeFullWidthPortraitWithHeight, |
|
14 |
/// GADAdSizeFullWidthLandscapeWithHeight. |
|
15 |
/// |
|
16 |
/// Do not create a GADAdSize manually. Use one of the GADAdSize constants. Treat GADAdSize as an |
|
17 |
/// opaque type. Do not access any fields directly. To obtain a concrete CGSize, use the function |
|
18 |
/// CGSizeFromGADAdSize(). |
|
19 |
typedef struct GAD_BOXABLE GADAdSize GADAdSize; |
|
20 |
|
|
21 |
/// Ad size. |
|
22 |
/// |
|
23 |
/// @see typedef GADAdSize |
|
24 |
struct GAD_BOXABLE GADAdSize { |
|
25 |
/// The ad size. Don't modify this value directly. |
|
26 |
CGSize size; |
|
27 |
/// Reserved. |
|
28 |
NSUInteger flags; |
|
29 |
}; |
|
30 |
|
|
31 |
#pragma mark Standard Sizes |
|
32 |
|
|
33 |
/// iPhone and iPod Touch ad size. Typically 320x50. |
|
34 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeBanner; |
|
35 |
|
|
36 |
/// Taller version of GADAdSizeBanner. Typically 320x100. |
|
37 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeLargeBanner; |
|
38 |
|
|
39 |
/// Medium Rectangle size for the iPad (especially in a UISplitView's left pane). Typically 300x250. |
|
40 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeMediumRectangle; |
|
41 |
|
|
42 |
/// Full Banner size for the iPad (especially in a UIPopoverController or in |
|
43 |
/// UIModalPresentationFormSheet). Typically 468x60. |
|
44 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeFullBanner; |
|
45 |
|
|
46 |
/// Leaderboard size for the iPad. Typically 728x90. |
|
47 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeLeaderboard; |
|
48 |
|
|
49 |
/// Skyscraper size for the iPad. Mediation only. AdMob/Google does not offer this size. Typically |
|
50 |
/// 120x600. |
|
51 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeSkyscraper; |
|
52 |
|
|
53 |
/// An ad size that spans the full width of its container, with a height dynamically determined by |
|
54 |
/// the ad. |
|
55 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeFluid; |
|
56 |
|
|
57 |
/// Invalid ad size marker. |
|
58 |
FOUNDATION_EXPORT GADAdSize const GADAdSizeInvalid; |
|
59 |
|
|
60 |
#pragma mark Inline Adaptive Sizes |
|
61 |
|
|
62 |
/// Returns a GADAdSize with the given width and the device's portrait height. This ad size |
|
63 |
/// allows Google servers to choose an optimal ad size less than or equal to the returned size. The |
|
64 |
/// exact size of the ad returned is passed through the banner's ad size delegate and is indicated |
|
65 |
/// by the banner's intrinsicContentSize. This ad size is most suitable for ads intended for scroll |
|
66 |
/// views. |
|
67 |
FOUNDATION_EXPORT GADAdSize GADPortraitInlineAdaptiveBannerAdSizeWithWidth(CGFloat width); |
|
68 |
|
|
69 |
/// Returns a GADAdSize with the given width and the device's landscape height. This ad size |
|
70 |
/// allows Google servers to choose an optimal ad size less than or equal to the returned size. The |
|
71 |
/// exact size of the ad returned is passed through the banner's ad size delegate and is indicated |
|
72 |
/// by the banner's intrinsicContentSize. This ad size is most suitable for ads intended for scroll |
|
73 |
/// views. |
|
74 |
FOUNDATION_EXPORT GADAdSize GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(CGFloat width); |
|
75 |
|
|
76 |
/// Returns a GADAdSize with the given width and the device's height. This is a convenience |
|
77 |
/// function to return GADPortraitInlineAdaptiveBannerAdSizeWithWidth or |
|
78 |
/// GADLandscapeInlineAdaptiveBannerAdSizeWithWidth based on the current interface orientation. |
|
79 |
/// This function must be called on the main queue. |
|
80 |
FOUNDATION_EXPORT GADAdSize GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(CGFloat width); |
|
81 |
|
|
82 |
/// Returns a GADAdSize with the given width and max height. This ad size allows Google servers to |
|
83 |
/// choose an optimal ad size less than or equal to the returned size. The exact size of the ad |
|
84 |
/// returned is passed through the banner's ad size delegate and is indicated by the banner's |
|
85 |
/// intrinsicContentSize. This ad size is most suitable for ads intended for scroll views. |
|
86 |
/// |
|
87 |
/// @param width The ad width. |
|
88 |
/// @param maxHeight The maximum height a loaded ad will have. Must be at least 32 px, but a max |
|
89 |
/// height of 50 px or higher is recommended. |
|
90 |
FOUNDATION_EXPORT GADAdSize GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(CGFloat width, |
|
91 |
CGFloat maxHeight); |
|
92 |
|
|
93 |
#pragma mark Anchored Adaptive Sizes |
|
94 |
|
|
95 |
/// Returns a GADAdSize with the given width and a Google-optimized height to create a banner ad. |
|
96 |
/// The size returned has an aspect ratio similar to that of GADAdSizeBanner, suitable for |
|
97 |
/// anchoring near the top or bottom of your app. The height is never larger than 15% of the |
|
98 |
/// device's portrait height and is always between 50-90 points. This function always returns the |
|
99 |
/// same height for any width / device combination. |
|
100 |
FOUNDATION_EXPORT GADAdSize GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width); |
|
101 |
|
|
102 |
/// Returns a GADAdSize with the given width and a Google-optimized height to create a banner ad. |
|
103 |
/// The size returned is suitable for use in a banner ad anchored near the top or bottom of your |
|
104 |
/// app, similar to use of GADAdSizeBanner. The height is never larger than 15% of the devices's |
|
105 |
/// landscape height and is always between 50-90 points. This function always returns the same |
|
106 |
/// height for any width / device combination. |
|
107 |
FOUNDATION_EXPORT GADAdSize GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width); |
|
108 |
|
|
109 |
/// Returns a GADAdSize with the given width and a Google-optimized height. This is a convenience |
|
110 |
/// function to return GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth or |
|
111 |
/// GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth based on the current interface orientation. |
|
112 |
/// This function must be called on the main queue. |
|
113 |
FOUNDATION_EXPORT GADAdSize |
|
114 |
GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width); |
|
115 |
|
|
116 |
#pragma mark Custom Sizes |
|
117 |
|
|
118 |
/// Returns a custom GADAdSize for the provided CGSize. Use this only if you require a non-standard |
|
119 |
/// size. Otherwise, use one of the standard size constants above. |
|
120 |
FOUNDATION_EXPORT GADAdSize GADAdSizeFromCGSize(CGSize size); |
|
121 |
|
|
122 |
/// Returns a custom GADAdSize that spans the full width of the application in portrait orientation |
|
123 |
/// with the height provided. |
|
124 |
FOUNDATION_EXPORT GADAdSize GADAdSizeFullWidthPortraitWithHeight(CGFloat height); |
|
125 |
|
|
126 |
/// Returns a custom GADAdSize that spans the full width of the application in landscape orientation |
|
127 |
/// with the height provided. |
|
128 |
FOUNDATION_EXPORT GADAdSize GADAdSizeFullWidthLandscapeWithHeight(CGFloat height); |
|
129 |
|
|
130 |
#pragma mark Convenience Functions |
|
131 |
|
|
132 |
/// Returns YES if the two GADAdSizes are equal, otherwise returns NO. |
|
133 |
FOUNDATION_EXPORT BOOL GADAdSizeEqualToSize(GADAdSize size1, GADAdSize size2); |
|
134 |
|
|
135 |
/// Returns a CGSize for the provided a GADAdSize constant. If the GADAdSize is unknown, returns |
|
136 |
/// CGSizeZero. |
|
137 |
FOUNDATION_EXPORT CGSize CGSizeFromGADAdSize(GADAdSize size); |
|
138 |
|
|
139 |
/// Returns YES if |size| is one of the predefined constants or is a custom GADAdSize generated by |
|
140 |
/// GADAdSizeFromCGSize. |
|
141 |
FOUNDATION_EXPORT BOOL IsGADAdSizeValid(GADAdSize size); |
|
142 |
|
|
143 |
/// Returns YES if |size| is a fluid ad size. |
|
144 |
FOUNDATION_EXPORT BOOL GADAdSizeIsFluid(GADAdSize size); |
|
145 |
|
|
146 |
/// Returns a NSString describing the provided GADAdSize. |
|
147 |
FOUNDATION_EXPORT NSString *_Nonnull NSStringFromGADAdSize(GADAdSize size); |
|
148 |
|
|
149 |
/// Returns an NSValue representing the GADAdSize. |
|
150 |
FOUNDATION_EXPORT NSValue *_Nonnull NSValueFromGADAdSize(GADAdSize size); |
|
151 |
|
|
152 |
/// Returns a GADAdSize from an NSValue. Returns GADAdSizeInvalid if the value is not a GADAdSize. |
|
153 |
FOUNDATION_EXPORT GADAdSize GADAdSizeFromNSValue(NSValue *_Nonnull value); |
|
154 |
|
|
155 |
#pragma mark Deprecated |
|
156 |
|
|
157 |
/// An ad size that spans the full width of the application in portrait orientation. The height is |
|
158 |
/// typically 50 points on an iPhone/iPod UI, and 90 points tall on an iPad UI. |
|
159 |
FOUNDATION_EXPORT GADAdSize const kGADAdSizeSmartBannerPortrait |
|
160 |
GAD_DEPRECATED_MSG_ATTRIBUTE("Use GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth."); |
|
161 |
|
|
162 |
/// An ad size that spans the full width of the application in landscape orientation. The height is |
|
163 |
/// typically 32 points on an iPhone/iPod UI, and 90 points tall on an iPad UI. |
|
164 |
FOUNDATION_EXPORT GADAdSize const kGADAdSizeSmartBannerLandscape |
|
165 |
GAD_DEPRECATED_MSG_ATTRIBUTE("Use GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth"); |