所以我使用教程在屏幕底部创建了一个 iAd 横幅并将其动画化进出窗口,但是该应用程序是基于选项卡的,我不太清楚正确的偏移量,所以你可以告诉我我会很感激,但主要问题是广告横幅并不总是出现,有时它只是一个白框。这是我的代码。在我的 .h
@interface section3 <ADBannerViewDelegate>{
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic, assign) BOOL bannerIsVisible;
//in the .m in the view did load
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0.0, 410.0f);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate = self;
self.bannerIsVisible = NO;
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0.0, -50.0f);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
if (self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0.0, 50.0f);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
我正在使用 Xcode 4.2.1 非常感谢,任何帮助将不胜感激:)