Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Xcode使iad粘在屏幕底部_Ios_Objective C_Xcode - Fatal编程技术网

Ios Xcode使iad粘在屏幕底部

Ios Xcode使iad粘在屏幕底部,ios,objective-c,xcode,Ios,Objective C,Xcode,我如何才能使iad横幅始终在屏幕底部,用户可以上下滚动,但添加将始终在那里(屏幕底部)。这是我用于iad的代码: ViewController.h @interface ViewController : UIViewController <ADBannerViewDelegate> 将此添加到AppDelegate的窗口,并将所有视图置于该横幅上方。i、 e.使用所有ViewController的横幅高度降低高度 “使用所有ViewController的横幅高度降低高度”是什么意思

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

ViewController.h

@interface ViewController : UIViewController <ADBannerViewDelegate>

将此添加到AppDelegate的窗口,并将所有视图置于该横幅上方。i、 e.使用所有ViewController的横幅高度降低高度

“使用所有ViewController的横幅高度降低高度”是什么意思?允许在底部有一个60像素的横幅。然后将其作为子视图添加到appDelegate的窗口中。现在,如果您的firstViewController(比如说它的学生列表)的高度为(screenHeight-statusBarHeight-adBannerHeight),否则视图将重叠,并且adBanner或ViewConcoller中的一部分将被隐藏。在开发我的一个应用程序时,我为这个特定问题实现了一个简洁的解决方案。如果你想和我联系,我很乐意帮助你。
// 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];

}