To discuss and provide feedback on our products, join the official AdMob Discord channel in the Google Advertising and Measurement Community server.

GoogleMobileAds Framework Reference

  • GADMediaAspectRatio is an enum defining different media aspect ratios for ad requests.

  • It includes options for unknown, any, landscape, portrait, and square (close to 1:1) aspect ratios.

  • Each aspect ratio is represented by an integer value accessible in both Swift and Objective-C.

  • Developers can utilize this enum to specify preferred aspect ratios when requesting ads, influencing ad creative selection.

GADMediaAspectRatio

enum GADMediaAspectRatio : NSInteger {}

Media aspect ratio.

  • Unknown media aspect ratio.

    Declaration

    Swift

    case unknown = 0

    Objective-C

    GADMediaAspectRatioUnknown = 0
  • Any media aspect ratio.

    Declaration

    Swift

    case any = 1

    Objective-C

    GADMediaAspectRatioAny = 1
  • Landscape media aspect ratio.

    Declaration

    Swift

    case landscape = 2

    Objective-C

    GADMediaAspectRatioLandscape = 2
  • Portrait media aspect ratio.

    Declaration

    Swift

    case portrait = 3

    Objective-C

    GADMediaAspectRatioPortrait = 3
  • Close to square media aspect ratio. This is not a strict 1:1 aspect ratio.

    Declaration

    Swift

    case square = 4

    Objective-C

    GADMediaAspectRatioSquare = 4

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年08月20日 UTC.