如何将AdWhirl-banner固定在TabBar上方?

发布于 2025-01-08 03:15:43 字数 470 浏览 1 评论 0原文

我的应用程序由一个 TabBar 和几个 TableView 组成。我希望将 AdWhirl 横幅固定在 TabBar 上方(仅在第一个 TableView 中),但到目前为止我还没有成功。

到目前为止,我已经在我的 TableViewController 中实现了以下代码:

AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[self.tableView addSubview:adWhirlView];
adWhirlView.center = CGPointMake(160, 342);

它确实显示了我想要看到的广告,只是它被部分标题(来自 TableView)部分覆盖,并且当滚动广告时会滚动。

如何实现广告既位于顶部(就俯视图而言)又位于固定位置(TabBar 上方)?

非常感谢任何帮助!

My app consists of a TabBar and several TableViews. I want to have the AdWhirl-banner fixed just above the TabBar (only in the first TableView), but thus far I have not been succeeding.

Until now, I have implemented the following code into my TableViewController:

AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[self.tableView addSubview:adWhirlView];
adWhirlView.center = CGPointMake(160, 342);

And it indeed shows the Ad i want to see, only it is partly covered by a section header (from the TableView), and when scrolling the Ad scrolls along.

How can I achieve that the Ad is both on top (in terms of top view) and at a fixed spot (above the TabBar)?

Any help is greatly appreciated!

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

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

发布评论

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

评论(3

面犯桃花 2025-01-15 03:15:43

您需要将其添加到 tabBar 层。
试试这个:

[self.tabBarController.view addSubview:adWhirlView];

您可能需要重新定位它,因为它不在选项卡栏下方。
我还在表格中添加了页脚,这样它们就可以一直向上滚动,而不会受到广告的干扰。

You need to add it to the tabBar layer.
Try this:

[self.tabBarController.view addSubview:adWhirlView];

You may need to reposition it do it's not underneath the tabbar.
I also add a footer to the tables so they can be scrolled all the way up without the ad getting in the way.

趴在窗边数星星i 2025-01-15 03:15:43

您可能需要创建自己的 UIViewController 子类,以编程方式或在 nib 文件中将 AdWhirlView 和 UITableView 的实例添加到其视图中。

Anthoer,更黑客的方法是将 AdWhirlView 添加为现有表中的标题视图,但我会选择第一种方法。它将让您更好地控制您想要的外观和行为。

You will likely need to create your own subclass of UIViewController, adding instances of both the AdWhirlView and UITableView to its view, either programatically, or in the nib file.

Anthoer, hackier way to do this would be to add the AdWhirlView as a header view in the existing table, but I'd opt for the first way. It will give you more control over how you want it to look and behave.

八巷 2025-01-15 03:15:43

我认为这里的另一种选择是拥有一个容器 UIView,其中包含 UITTabBar 和 UITableView。如果您位于正确的选项卡上,则只需请求广告即可。如果请求成功,只需将选项卡式视图缩小到足以为顶部的广告腾出空间并将其插入到容器 UIView 中即可。

I'd think another alternative here would be to have a container UIView that contains both a UITTabBar which contains a UITableView. If you're on the right tab, you could just request an ad. If the request is successful, just shrink the tabbed view enough to make room for the ad at the top and insert it into the container UIView.

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