编辑:我已经弄清楚问题是什么.每次调用showBannerVIEw:时,Apple的示例显然会将_bannerVIEw添加到self.vIEw,但永远不会删除视图.由于横幅视图在屏幕外移动,但仍然没有完全合理,但删除它确实解决了空白问题.我的解决方案如下,但如果有人有更优雅的方式,请告诉我.
- (voID)layoutAnimated:(BOol)animated { if (UIInterfaceOrIEntationIsPortrait(self.interfaceOrIEntation)) { _bannerVIEw.currentContentSizeIDentifIEr = ADBannerContentSizeIDentifIErPortrait; } else { _bannerVIEw.currentContentSizeIDentifIEr = ADBannerContentSizeIDentifIErLandscape; } CGRect contentFrame = self.vIEw.bounds; contentFrame.origin = CGPointMake(0.0,0.0); CGRect bannerFrame = _bannerVIEw.frame; if (_bannerVIEw.bannerLoaded) { contentFrame.size.height -= _bannerVIEw.frame.size.height; bannerFrame.origin.y = contentFrame.size.height; } else { bannerFrame.origin.y = contentFrame.size.height; } [UIVIEw animateWithDuration:animated ? 0.25 : 0.0 animations:^{ _contentVIEw.frame = contentFrame; [_contentVIEw layoutIfNeeded]; _bannerVIEw.frame = bannerFrame; } completion:^(BOol finished) { if (!_bannerVIEw.bannerLoaded) { [_bannerVIEw removeFromSupervIEw]; _bannerVIEw=nil; } }];}- (voID)showBannerVIEw:(ADBannerVIEw *)bannerVIEw animated:(BOol)animated{ _bannerVIEw = bannerVIEw; if (![self.vIEw.subvIEws containsObject:_bannerVIEw]) [self.vIEw addSubvIEw:_bannerVIEw]; [self layoutAnimated:animated];}- (voID)hIDeBannerVIEw:(ADBannerVIEw *)bannerVIEw animated:(BOol)animated{ [self layoutAnimated:animated];}解决方法 我有同样的问题.从hIDeBannerVIEw委托方法中的超级视图中删除bannervIEw似乎已经解决了它.
- (voID)hIDeBannerVIEw:(ADBannerVIEw *)bannerVIEw animated:(BOol)animated{ [self layoutAnimated:animated]; [_bannerVIEw removeFromSupervIEw]; _bannerVIEw = nil;}总结
以上是内存溢出为你收集整理的objective-c – 当广告消失时,iAdSuite bug会留下空格全部内容,希望文章能够帮你解决objective-c – 当广告消失时,iAdSuite bug会留下空格所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)