Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7849159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:26:34+00:00 2026-06-02T18:26:34+00:00

I’ve pretty much searched everywhere for the answer. // // GADAdSize.h // Google Ads

  • 0

I’ve pretty much searched everywhere for the answer.

//
//  GADAdSize.h
//  Google Ads iOS SDK
//
//  Copyright 2012 Google Inc. All rights reserved.
//
//  A valid GADAdSize is considered to be one of the predefined GADAdSize
//  constants or a GADAdSize constructed by GADAdSizeFromCGSize,
//  GADAdSizeFullWidthPortraitWithHeight, GADAdSizeFullWidthLandscapeWithHeight.
//

#import <UIKit/UIKit.h>

// Do not create a GADAdSize manually. Use one of the kGADAdSize constants.
// Treat GADAdSize as an opaque type. Do not access any fields directly. To
// obtain a concrete CGSize, use the function CGSizeFromGADAdSize().
typedef struct GADAdSize {
  CGSize size;
  NSUInteger flags;
} GADAdSize;

#pragma mark Standard Sizes

// iPhone and iPod Touch ad size. Typically 320x50.
extern GADAdSize const kGADAdSizeBanner;

// Medium Rectangle size for the iPad (especially in a UISplitView's left pane).
// Typically 300x250.
extern GADAdSize const kGADAdSizeMediumRectangle;

// Full Banner size for the iPad (especially in a UIPopoverController or in
// UIModalPresentationFormSheet). Typically 468x60.
extern GADAdSize const kGADAdSizeFullBanner;

// Leaderboard size for the iPad. Typically 728x90.
extern GADAdSize const kGADAdSizeLeaderboard;

// Skyscraper size for the iPad. Mediation only. AdMob/Google does not offer
// this size. Typically 120x600.
extern GADAdSize const kGADAdSizeSkyscraper;

// An ad size that spans the full width of the application in portrait
// orientation. The height is typically 50 pixels on an iPhone/iPod UI, and 90
// pixels tall on an iPad UI.
extern GADAdSize const kGADAdSizeSmartBannerPortrait;

// An ad size that spans the full width of the application in landscape
// orientation. The height is typically 32 pixels on an iPhone/iPod UI, and 90
// pixels tall on an iPad UI.
extern GADAdSize const kGADAdSizeSmartBannerLandscape;

// Invalid ad size marker.
extern GADAdSize const kGADAdSizeInvalid;

#pragma mark Custom Sizes

// Given a CGSize, return a custom GADAdSize. Use this only if you require a
// non-standard size, otherwise, use one of the standard size constants above.
GADAdSize GADAdSizeFromCGSize(CGSize size);

// Get a custom GADAdSize that spans the full width of the application in
// portrait orientation with the height provided.
GADAdSize GADAdSizeFullWidthPortraitWithHeight(CGFloat height);

// Get a custom GADAdSize that spans the full width of the application in
// landscape orientation with the height provided.
GADAdSize GADAdSizeFullWidthLandscapeWithHeight(CGFloat height);

#pragma mark Convenience Functions

// Checks whether the two GADAdSizes are equal.
BOOL GADAdSizeEqualToSize(GADAdSize size1, GADAdSize size2);

// Given a GADAdSize constant, returns a CGSize. If the GADAdSize is unknown,
// returns CGSizeZero.
CGSize CGSizeFromGADAdSize(GADAdSize size);

// Determines if |size| is one of the predefined constants, or a custom
// GADAdSize generated by FromCGSize.
BOOL IsGADAdSizeValid(GADAdSize size);

// Given a GADAdSize constant, returns a NSString describing the GADAdSize.
NSString *NSStringFromGADAdSize(GADAdSize size);


#pragma mark Deprecated Macros

#define GAD_SIZE_320x50     CGSizeFromGADAdSize(kGADAdSizeBanner)
#define GAD_SIZE_300x250    CGSizeFromGADAdSize(kGADAdSizeMediumRectangle)
#define GAD_SIZE_468x60     CGSizeFromGADAdSize(kGADAdSizeFullBanner)
#define GAD_SIZE_728x90     CGSizeFromGADAdSize(kGADAdSizeLeaderboard)
#define GAD_SIZE_120x600    CGSizeFromGADAdSize(kGADAdSizeSkyscraper)

This is what was given in the viewdidload example project.

- (void)viewDidLoad {
  [super viewDidLoad];

  // Initialize the banner at the bottom of the screen.
  CGPoint origin = CGPointMake(0.0,
                               self.view.frame.size.height -
                               CGSizeFromGADAdSize(kGADAdSizeBanner).height);





  // Use predefined GADAdSize constants to define the GADBannerView.
  self.adBanner = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner
                                                  origin:origin]
                    autorelease];

  // Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
  // before compiling.
  self.adBanner.adUnitID = kSampleAdUnitID;
  self.adBanner.delegate = self;
  [self.adBanner setRootViewController:self];
  [self.view addSubview:self.adBanner];
  [self.adBanner loadRequest:[self createRequest]];
}

I’m not the best at objective C, and could use a short description on what’s happening when this code is called. There is a similar question to this for Android, I thought I’d ask for the iPhoners. Everyone on Google is using the Deprecated Macros.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:26:35+00:00Added an answer on June 2, 2026 at 6:26 pm

    The example code you’re looking at initializes the ad at the bottom of the screen with an origin at the bottom of the screen (the origin is specifically (0, HEIGHT_OF_SCREEN-HEIGHT_OF_AD).

    The initWithSize: constructor defaults to initializing the ad at the top of the screen at (0,0) so if you just initialize your adBanner as so:

    self.adBanner = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner]
                        autorelease];
    

    You should see the ad come in at the top of the screen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm making a simple page using Google Maps API 3. My first. One marker
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.