iad iPhone 5 Storyboard实施 [英] iad iPhone 5 Storyboard implementation

查看:82
本文介绍了iad iPhone 5 Storyboard实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用商店上有一个付费应用,并且我正在尝试通过广告制作该应用的免费版本. 我当时正在考虑使用iAds.我实现了以下代码:

I have a paid app on the app store, and I'm trying to make a free version of the same app with ads. I was thinking about using iAds. I implemented the following code:

-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.01];
    [banner setAlpha:1];
    [UIView commitAnimations];
    CGRect adFrame = adView.frame;
    adFrame.origin.y = self.view.frame.size.height;
    adView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin;
}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [banner setAlpha:0];
    [adView setAlpha:0];
    [UIView commitAnimations];
}

除了一件事之外,它的工作效果非常好.我的应用程序具有一个情节提要,以及一个连接到同一情节提要中的多个视图控制器的表视图控制器.我将广告横幅视图拖动到视图控制器上,尽管我想将其放置在底部,所以当我将其放置在iPhone 4的底部时,它几乎会显示在iPhone 5的中部,而当我将其放置在在iPhone 5的底部,它根本不会在iPhone 4上显示.因此,我想出了一个主意.我放置了2个广告横幅视图,并做出了if语句,其中iPhone 4横幅将隐藏在iPhone 5上,iPhone 5横幅将隐藏在iPhone 4上.虽然,我注意到在iPhone 4上始终会加载iAd标语,而在iPhone 5上仅会加载iAd标语.另外,我注意到Apple建议每个视图控制器即使被隐藏也不要使用一个以上的横幅.

And it is working great except for one thing. My app has a storyboard, and a table view controller connected to multiple view controllers inside the same storyboard. I dragged a Ad Banner View to the view controller, although, I want to place it on the bottom, so when I placed at the bottom of iPhone 4 it would show almost in the middle of the iPhone 5, and when I placed on the bottom of iPhone 5 it does not show on iPhone 4 at all. So, I came up with an idea. I placed 2 Ad banner view, and made an if statement, where on the iPhone 5 the iPhone 4 banner would hide, and the iPhone 4 the iPhone 5 banner would hide. Although, I noticed that on the iPhone 4 the iAd banner always loaded up, where on the iPhone 5 it only loads sometimes. Also, I noticed that Apple recomends not to use more than one banner per view controller, even if it's hidden.

有人可以帮我吗? 请! 谢谢!

Can somebody please help me? Please! Thank you!

推荐答案

您需要设置广告横幅的自动调整大小. 只需在情节提要板中单击广告编辑器,然后打开大小检查器并设置底部自动缩放"属性,如下图所示.然后,您的广告横幅几乎会停留在底部.

You need to set the autoresizing of the Ad banner. Just click on ad baneer in storyboard then open size inspector and set Bottom autoresing property as shown in picture below. Then your ad banner will almost stay in bottom.

点击广告横幅,然后点击尺寸检查器. 让我知道它是否有效.

Click on Ad banner and then click Size inspector. Let me know if its working.

这篇关于iad iPhone 5 Storyboard实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆