2014-09-22 76 views
0

我怎样才能让iad的横幅总是在屏幕的底部,用户可以上下滚动,但添加将始终存在(屏幕底部)。这是我的代码,我使用的IAD:Xcode使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]; 

} 
+0

我在开发我的一个应用程序时为这个特定问题实施了一个整洁的解决方案。如果您想通过https://www.codementor.io/francesco与我联系,我很乐意为您提供帮助。 – singingAtom 2014-09-22 21:34:44

回答

0

添加到您的AppDelegate中的窗口,并把上述所有的意见那个横幅。即降低所有ViewController的横幅高度的高度。

+0

你是什么意思“降低所有ViewControllers的横幅高度的高度”? – testacc 2014-09-22 21:21:41

+0

可让您在底部有60px的横幅。你可以把它作为子视图添加到你的appDelegate窗口中。现在,如果你的firstViewController(假设它是学生列表)应该具有高度(screenHeight - statusBarHeight - adBannerHeight),否则视图将重叠,并且adBanner或viewCongroller中的一部分将隐藏 – Saad 2014-09-22 21:48:33