user542584
user542584

Reputation: 2699

Rotating the iphone obscures ad

I am using iAds with banner views. The following code brings up the warning saying that the ad is obscured.

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {

            _bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;//WARNING SHOWN WHEN THIS STATEMENT EXECUTES

    } else {
        _bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;

    }
    [self layoutAnimated:duration > 0.0];
}

Cannot figure out why the ad should be obscured when all I did was to change the interface orientation. Any clues appreciated.

Upvotes: 1

Views: 74

Answers (1)

Neelam Verma
Neelam Verma

Reputation: 3274

Have you set following at first time when you create shared object of banner View??

If No , Then try this may this will help.

if (&ADBannerContentSizeIdentifierPortrait != NULL)
    {
       [_sharedBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects:ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil]];            
    }
else
    {  
                [_sharedBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects:ADBannerContentSizeIdentifier320x50, ADBannerContentSizeIdentifier480x32, nil]];            
    }

Upvotes: 2

Related Questions