Baner iAd nie jest klikalny, jeśli baner się porusza
Mam baner iAd działający w aplikacji Cocos2d.
Oto kod podklasy CCLayer, którą stworzyłem, aby wyświetlać reklamy. W DidLoad dodatek staje się widoczny, a dolne menu przesuwa się w górę w celu skompensowania.
-(id) init
{
if( (self=[super init]) ) {
CGSize size = [[CCDirector sharedDirector] winSize];
UIViewController *controller = [[UIViewController alloc] init];
controller.view.frame = CGRectMake(0, size.height -32, 320, 32);
ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierLandscape];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
[controller.view addSubview:adView];
adView.delegate = self;
[[[CCDirector sharedDirector] view] addSubview:controller.view];
[[[CCDirector sharedDirector] view] setNeedsLayout]; // I was told this would fix it, but it fails to.
}
return self;
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!bannerIsVisible)
{
NSLog(@"bannerViewDidLoadAd");
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -32); //the offending line
self.position = ccpAdd(ccp(0, 32), self.position);
[UIView commitAnimations];
bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (bannerIsVisible)
{
NSLog(@"bannerView:didFailToReceiveAdWithError:");
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, 32); //the other offending line
self.position = ccpAdd(ccp(0, -32), self.position);
[UIView commitAnimations];
bannerIsVisible = NO;
}
}
Gdy te linie są wyłączone, baner jest klikalny, ale brzydki biały sztandar jest widoczny. Co z tym jest? Jak to naprawić lub obejść?