0
我在屏幕底部添加了用于实现iAd的横幅视图。但是在模拟器上运行时,横幅视图稍微高于固定的框架。它显示为透明条,不可选。经过一段时间后,它会自动到达底部,作为一个黑色的测试广告。iAd在未加载iPhone时的动画
我希望横幅视图坚持底部,而不是动画。
这是我的代码。 adView声明代码:
adView = [[[ADBannerView alloc] initWithFrame:CGRectOffset(CGRectZero, 0, 350)] autorelease];
adView.frame = CGRectMake(0,340,320,25);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
adView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
adView.tag = 111;
[self.navigationController.view addSubview:adView];
adView.delegate = self;
self.bannerIsVisible = NO;
adView.hidden = YES;
以下是委托方法。
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// banner is invisible now and moved out of the screen on 50 px
banner.frame = CGRectOffset(banner.frame, 0, 50);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
// When iAd is not availale on the banner
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// banner is visible and we move it out of the screen, due to connection issue
banner.frame = CGRectOffset(banner.frame, 0, 520);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
我无法理解问题。请帮助。
我稍后通过界面构建器直接放置横幅视图。但似乎在一段时间后会改变立场。 – Bismita 2010-10-08 09:05:01