Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
274 views
in Technique[技术] by (71.8m points)

iphone - iAd Landscape Strange View Behavior

I have an iAd which displays at the top of a fullscreen subview of the main view. The iAd works normally in portrait mode, and I have handled rotation of the iAd banner view into landscape mode. The issue occurs when the iAd is tapped by the user in landscape mode. The test advertisement displays in portrait, sideways on the phone, and when the user taps the x to dismiss the iAd, the banner view and its parent view are pushed offscreen. The iAd behaves normally in portrait mode (i.e. tapping it and closing it results in the view containing the banner to be displayed normally).

Things I have tried:

- (void)bannerViewActionDidFinish:(ADBannerView *)banner{
NSLog(@"Ad was closed, show the adView again");
if(UIInterfaceOrientationIsLandscape(currentInterfaceOrientation)){
    [self animateRotationToLandscape:0.3f];
}
else{
    [self animateRotationToPortrait:0.3f];
}
}

-(void)animateRotationToPortrait:(NSTimeInterval)duration{
    self.adView.currentContentSizeIdentifier =
    ADBannerContentSizeIdentifierPortrait;

    BOOL iPad = NO;
    #ifdef UI_USER_INTERFACE_IDIOM
    iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
    #endif

    if (iPad) {
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:duration];
        proUpgradeDescription.frame = CGRectMake(82,313,604,110);
        proUpgradePrice.frame = CGRectMake(313,576,142,28);
        closeButton.frame = CGRectMake(348,834,72,37);
        purchaseButton.frame = CGRectMake(313,431,142,142);
        [UIView commitAnimations];
    }
    else{
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:duration];
        proUpgradeDescription.frame = CGRectMake(20,80,280,70);
        proUpgradePrice.frame = CGRectMake(88,322,142,28);
        closeButton.frame = CGRectMake(123,403,72,37);
        purchaseButton.frame = CGRectMake(88,172,142,142);
        [UIView commitAnimations];
    }
}

Which calls code that I use to animate rotation of the display for portrait and landscape mode. This code has no effect.

If anyone has any ideas as to why the test advertisements don't rotate correctly and why they push the parent view controller off the screen I would greatly appreciate it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I don't know if this addresses all of your problems, but according to the answer on this question, the test ads are only in portrait, and real ads will show up in both orientations.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...