Xcode使iad坚持到屏幕的底部

时间:2014-09-22 21:10:26

标签: ios objective-c xcode

如何让iad横幅总是在屏幕的底部,用户可以上下滚动,但添加将始终在那里(屏幕的底部)。这是我用于iad的代码:

ViewController.h

@interface ViewController : UIViewController <ADBannerViewDelegate>

ViewController.m

// Method is called when the iAd is loaded.
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {

    // Creates animation.
    [UIView beginAnimations:nil context:nil];

    // Sets the duration of the animation to 1.
    [UIView setAnimationDuration:1];

    // Sets the alpha to 1.
        [banner setAlpha:1];

    //  Performs animation.
    [UIView commitAnimations];

}

// Method is called when the iAd fails to load.
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {

    // Creates animation.
    [UIView beginAnimations:nil context:nil];

    // Sets the duration of the animation to 1.
    [UIView setAnimationDuration:1];

    // Sets the alpha to 0.
       [banner setAlpha:0];

    //  Performs animation.
    [UIView commitAnimations];

}

1 个答案:

答案 0 :(得分:0)

将此添加到AppDelegate的窗口,并将所有视图放在该横幅上方。即降低所有ViewControllers的横幅高度。