Question

What I tried so far is, in viewDidLoad, I called

self.bannerView.autoresizingMask=UIViewAutoresizingFlexibleWidth;

and

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)newInterfaceOrientation duration:(NSTimeInterval)duration {
    if (newInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || newInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        self.bannerView.frame=CGRectMake(0.0,
                                         0.0,
                                         480.0,
                                         GAD_SIZE_320x50.height);
    }
    // Position the UI elements for portrait mode
    else {
        self.bannerView.frame=CGRectMake(0.0,
                                         0.0,
                                         GAD_SIZE_320x50.width,
                                         GAD_SIZE_320x50.height);
    }
}

Both of these didn't work for me.

Was it helpful?

Solution

Hmm, I don't think that AdMob's creatives can stretch to fit the size of the screen when in landscape. So despite the fact that you're stretching the frame of the view to fit, the ad itself I think will stay the same size.

This means you should still see an ad come in on orientation changes, it will just look like it's the same size (make sure to make another request for an ad in the willAnimateRotationToInterfaceOrientation: method to see this).

OTHER TIPS

You don't need to do any moves, but you must set correct rootViewController for adMovView.

If you use view controller model please add line in each custom view controller

adMobView.rootViewController = viewController;

where viewController - root view controller of your app.

Do not code like this

adMobView.rootViewController = self; 

in custom view!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top