ios - iAd covers my view on the first load -



ios - iAd covers my view on the first load -

i have iads working using modified version of uitabbarcontroller-iads. issue have on very first load of advert view gets covered. 1 time advertisement refreshes after 30 seconds view resizes fine.

i'm using next code:

- (void)layoutbanner { float height = 0.0; adbannerview *_banner = (adbannerview *)[self.view viewwithtag:12]; cgrect bounds = [uiscreen mainscreen].bounds; if (uiinterfaceorientationisportrait(self.interfaceorientation)) { _banner.currentcontentsizeidentifier = adbannercontentsizeidentifierportrait; } else { _banner.currentcontentsizeidentifier = adbannercontentsizeidentifierlandscape; } //when compiling against ios 8 sdk needs height, regardless of actual device orientation height = bounds.size.height; cgsize bannersize = [adbannerview sizefrombannercontentsizeidentifier:_banner.currentcontentsizeidentifier]; //get content view uiview *_contentview = self.selectedviewcontroller.view; cgrect contentframe = _contentview.frame; cgrect bannerframe = _banner.frame; if (_banner.isbannerloaded) { if (ios7) { contentframe.size.height = height - bannersize.height; bannerframe.origin.y = contentframe.size.height - self.tabbar.frame.size.height; } else { contentframe.size.height = height - self.tabbar.frame.size.height - bannersize.height; bannerframe.origin.y = contentframe.size.height; } } else { if (ios7) { contentframe.size.height = height; bannerframe.origin.y = bounds.size.height; } else { contentframe.size.height = height - self.tabbar.frame.size.height; bannerframe.origin.y = bounds.size.height; } } [uiview animatewithduration:0.25 animations:^{ _banner.frame = bannerframe; _contentview.frame = contentframe; } completion:^(bool finished) { [self.view bringsubviewtofront:_banner]; }]; } - (void)bannerviewdidloadad:(adbannerview *)banner { nslog(@"did load"); [self layoutbanner]; }

any ideas?

i managed prepare issue playing around animation block. moved content view line , resolved issue

[uiview animatewithduration:0.25 animations:^{ _banner.frame = bannerframe; } completion:^(bool finished) { _contentview.frame = contentframe; [self.view bringsubviewtofront:_banner]; }];

ios resize advertising iad

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -