AI-generated Key Takeaways
- 
          Globally available functions are provided for managing Google AdMob banner ad sizes in iOS applications. 
- 
          Functions exist for obtaining inline adaptive banner ad sizes for portrait, landscape, and current device orientations, which are suitable for scroll views and allow Google to choose an optimal ad size. 
- 
          Anchored adaptive banner ad size functions are available for portrait, landscape, and current device orientations, providing Google-optimized heights suitable for anchoring near the top or bottom of the app. 
- 
          Custom ad sizes can be created using specific width and height values or by spanning the full width in portrait or landscape orientations with a specified height. 
- 
          Convenience functions are included for comparing, validating, and converting GADAdSize objects, as well as getting a string representation of the version number. 
Functions
The following functions are available globally.
- 
                  
                  Returns a GADAdSize with the given width and the device’s portrait height. This ad size allows Google servers to choose an optimal ad size less than or equal to the returned size. The exact size of the ad returned is passed through the banner’s ad size delegate and is indicated by the banner’s intrinsicContentSize. This ad size is most suitable for ads intended for scroll views. DeclarationSwift func portraitInlineAdaptiveBanner(width: CGFloat) -> AdSizeObjective-C extern GADAdSize GADPortraitInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)
- 
                  
                  Returns a GADAdSize with the given width and the device’s landscape height. This ad size allows Google servers to choose an optimal ad size less than or equal to the returned size. The exact size of the ad returned is passed through the banner’s ad size delegate and is indicated by the banner’s intrinsicContentSize. This ad size is most suitable for ads intended for scroll views. DeclarationSwift func landscapeInlineAdaptiveBanner(width: CGFloat) -> AdSizeObjective-C extern GADAdSize GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)
- 
                  
                  Returns a GADAdSize with the given width and the device’s height. This is a convenience function to return GADPortraitInlineAdaptiveBannerAdSizeWithWidth or GADLandscapeInlineAdaptiveBannerAdSizeWithWidth based on the current interface orientation. This function must be called on the main queue. DeclarationSwift func currentOrientationInlineAdaptiveBanner(width: CGFloat) -> AdSizeObjective-C extern GADAdSize GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)
- 
                  
                  Returns a GADAdSize with the given width and max height. This ad size allows Google servers to choose an optimal ad size less than or equal to the returned size. The exact size of the ad returned is passed through the banner’s ad size delegate and is indicated by the banner’s intrinsicContentSize. This ad size is most suitable for ads intended for scroll views. DeclarationSwift func inlineAdaptiveBanner(width: CGFloat, maxHeight: CGFloat) -> AdSizeObjective-C extern GADAdSize GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(CGFloat width, CGFloat maxHeight)ParameterswidthThe ad width. maxHeightThe maximum height a loaded ad will have. Must be at least 32 px, but a max height of 50 px or higher is recommended. 
- 
                  
                  Returns a GADAdSize with the given width and a Google-optimized height to create a banner ad. The size returned has an aspect ratio similar to that of GADAdSizeBanner, suitable for anchoring near the top or bottom of your app. The height is never larger than 15% of the device’s portrait height and is always between 50-90 points. This function always returns the same height for any width / device combination. DeclarationSwift func portraitAnchoredAdaptiveBanner(width: CGFloat) -> AdSizeObjective-C extern GADAdSize GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)
- 
                  
                  Returns a GADAdSize with the given width and a Google-optimized height to create a banner ad. The size returned is suitable for use in a banner ad anchored near the top or bottom of your app, similar to use of GADAdSizeBanner. The height is never larger than 15% of the devices’s landscape height and is always between 50-90 points. This function always returns the same height for any width / device combination. DeclarationSwift func landscapeAnchoredAdaptiveBanner(width: CGFloat) -> AdSizeObjective-C extern GADAdSize GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)
- 
                  
                  Returns a GADAdSize with the given width and a Google-optimized height. This is a convenience function to return GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth or GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth based on the current interface orientation. This function must be called on the main queue. DeclarationSwift func currentOrientationAnchoredAdaptiveBanner(width: CGFloat) -> AdSizeObjective-C extern GADAdSize GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)
- 
                  
                  Returns a custom GADAdSize for the provided CGSize. Use this only if you require a non-standard size. Otherwise, use one of the standard size constants above. DeclarationSwift func adSizeFor(cgSize size: CGSize) -> AdSizeObjective-C extern GADAdSize GADAdSizeFromCGSize(CGSize size)
- 
                  
                  Returns a custom GADAdSize that spans the full width of the application in portrait orientation with the height provided. DeclarationSwift func fullWidthPortrait(height: CGFloat) -> AdSizeObjective-C extern GADAdSize GADAdSizeFullWidthPortraitWithHeight(CGFloat height)
- 
                  
                  Returns a custom GADAdSize that spans the full width of the application in landscape orientation with the height provided. DeclarationSwift func fullWidthLandscape(height: CGFloat) -> AdSizeObjective-C extern GADAdSize GADAdSizeFullWidthLandscapeWithHeight(CGFloat height)
- 
                  
                  Returns YES if |size| is one of the predefined constants or is a custom GADAdSize generated by GADAdSizeFromCGSize. DeclarationSwift func isAdSizeValid(size: AdSize) -> BoolObjective-C extern BOOL IsGADAdSizeValid(GADAdSize size)
- 
                  
                  Returns YES if |size| is a fluid ad size. DeclarationSwift func isAdSizeFluid(size: AdSize) -> BoolObjective-C extern BOOL GADAdSizeIsFluid(GADAdSize size)
- 
                  
                  Returns a CGSize for the provided a GADAdSize constant. If the GADAdSize is unknown, returns CGSizeZero. DeclarationSwift func cgSize(for size: AdSize) -> CGSizeObjective-C extern CGSize CGSizeFromGADAdSize(GADAdSize size)
- 
                  
                  Returns a NSString describing the provided GADAdSize. DeclarationSwift func string(for size: AdSize) -> StringObjective-C extern NSString *_Nonnull NSStringFromGADAdSize(GADAdSize size)
- 
                  
                  Returns an NSValue representing the GADAdSize. DeclarationSwift func nsValue(for size: AdSize) -> NSValueObjective-C extern NSValue *_Nonnull NSValueFromGADAdSize(GADAdSize size)
- 
                  
                  Returns a GADAdSize from an NSValue. Returns GADAdSizeInvalid if the value is not a GADAdSize. DeclarationSwift func adSizeFor(nsValue value: NSValue) -> AdSizeObjective-C extern GADAdSize GADAdSizeFromNSValue(NSValue *_Nonnull value)
- 
                  
                  Returns the closest valid ad size from possibleAdSizes as compared to |original|. The selected size must be smaller than or equal in size to the original. The selected size must also be within a configurable fraction of the width and height of the original. If no valid size exists, returns GADAdSizeInvalid. 
- 
                  
                  Returns a string representation of the version number. DeclarationSwift func string(for version: VersionNumber) -> StringObjective-C NSString *_Nonnull GADGetStringFromVersionNumber(GADVersionNumber version)