尝试将 iAd 移出屏幕时出错

发布于 2024-09-08 13:21:22 字数 627 浏览 1 评论 0原文

按照 Apple 的要求,尝试在没有加载广告时让 iAds 关闭屏幕。他们给了我这段代码:

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
 if (self.bannerIsVisible)
 {
  [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
   // assumes the banner view is at the top of the screen.
  banner.frame = CGRectOffset(banner.frame, 0, -50);
  [UIView commitAnimations];
  self.bannerIsVisible = NO;
 }
}

我让我的视图成为 iAds 之类的委托,但每当我尝试编译时,我得到:

"Request for member 'bannerIsVisible' in something not a structure or union

我尝试添加 BOOL BannerIsVisible,但这只会让事情变得更糟

Trying to make iAds go off screen when no ad is loaded, as per Apple's request. They gave me this code:

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
 if (self.bannerIsVisible)
 {
  [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
   // assumes the banner view is at the top of the screen.
  banner.frame = CGRectOffset(banner.frame, 0, -50);
  [UIView commitAnimations];
  self.bannerIsVisible = NO;
 }
}

I made my view a delegate for iAds and whatnot, but whenever I try to compile, I get:

"Request for member 'bannerIsVisible' in something not a structure or union

I tried adding a BOOL bannerIsVisible, but it just made things worse

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乱世争霸 2024-09-15 13:21:22

要使用 self.bannerIsVisible,您需要将 bannerIsVisible 声明为属性。

To use self.bannerIsVisible you need to have bannerIsVisible declared as a property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文