使用 MKMapView 添加 adWhirl 视图

发布于 2024-10-03 17:51:57 字数 960 浏览 1 评论 0原文

我正在尝试在与具有 MKMapView 对象的视图相同的视图中实现 adWhirl 视图。如果我遵循适用于我的 tableView 的标准步骤,那么

awView = [AdWhirlView requestAdWhirlViewWithDelegate:self]; 
[self.view addSubview:awView];

有趣的行为就会开始。在模拟器中,它会收到触摸并发送给您。但是,当在我的测试设备(运行 3.1.3)上运行时,触摸会传递到地图。

有人告诉我,这是因为 awView 被转换为 mapView 的子视图,并且它必须是它自己的视图。但如何呢?我尝试创建一个单独的 UIView,然后将 awView 放入其中,然后将其定位在固定位置,但它不是固定位置,而是相对于 mapView 加载,并且仍然不接收触摸。

有什么建议吗?

附录:我以为我将两者添加为子视图,但没有取得任何成功。我所做的是在 IB 中创建两个视图。最上面的一个(firstView)有两个子视图(bannerForAd和mapView)。这就是我现在所拥有的。

self.awView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
self.awView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
[bannerForAd addSubview:awView];

mapView = [[MKMapView alloc] initWithFrame:self.view.frame];
mapView = (MKMapView*)self.view;
mapView.delegate = self;

[firstView addSubview:mapView];
[firstView bringSubviewToFront:bannerForAd];

现在地图显示正常,但广告甚至不可见。

I am trying to implement an adWhirl view in the same view as one that has an MKMapView object. If I follow the standard steps that work fine with my tableViews, that is

awView = [AdWhirlView requestAdWhirlViewWithDelegate:self]; 
[self.view addSubview:awView];

then the funny behavior starts. In the simulator it receives the touch and sends you on. But when running on my test device (running 3.1.3) the touch passes through to the map.

I have been told that this is because awView is being cast as a subView of mapView and that it must be its own view. But how? I have tried creating a separate UIView and then placing awView in it, then locating it at a fixed location, but instead of the fixed location, it loads relative to mapView and still does not receive touches.

Any suggestions?

Addendum: I thought that I was adding both as subviews but have not had any success. What I had done is to create two views in IB. The top one (firstView) has two subviews (bannerForAd and mapView.) This is what I have now

self.awView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
self.awView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
[bannerForAd addSubview:awView];

mapView = [[MKMapView alloc] initWithFrame:self.view.frame];
mapView = (MKMapView*)self.view;
mapView.delegate = self;

[firstView addSubview:mapView];
[firstView bringSubviewToFront:bannerForAd];

Now the map shows fine, but the ad is not even visible.

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

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

发布评论

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

评论(1

枉心 2024-10-10 17:51:57

将 AdWhirlView 和 MKMapView 都粘贴为 UIView 的子视图。

Stick both the AdWhirlView and the MKMapView as a subview of a UIView.

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