有没有办法旋转 MKMapView 并仍然显示 Google 徽标?

发布于 2024-10-06 16:26:58 字数 331 浏览 4 评论 0原文

好吧,我见过一些类似的问题,但似乎找不到真正回答这个问题的问题,所以就到这里吧。

我正在旋转(或想要)一个 MKMapView:

[mapView setTransform:CGAffineTransformMakeRotation(angle)];

这工作正常,除了 Google 徽标随之旋转,我听说这是不行的。另外,我实际上想让我的地图视图大于屏幕,以便旋转时整个屏幕仍然显示地图,但这也会将 Google 徽标移出屏幕。

那么是否可以旋转 MkMapView 并仍然显示 Google 徽标???也许需要调用一些 Google Web AP

Ok, so I've seen some similar questions to this, but can't seem to find any that really answer the question so here goes.

I'm rotating (or would like to) an MKMapView:

[mapView setTransform:CGAffineTransformMakeRotation(angle)];

This works fine, except that the Google Logo gets rotated with it, which I hear is a no no. Also I would like to actually make my mapView larger than the screen so that when rotated the entire screen still shows map, but this would also move the Google Logo off the screen.

So is it possible to rotate an MkMapView and still show the Google Logo ??? Maybe a call out to some Google Web AP

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

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

发布评论

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

评论(2

明媚殇 2024-10-13 16:26:58

所以我找到了一种方法来做到这一点,尽管我仍然觉得它有点像黑客,因为苹果可能会在未来的版本中改变一些东西,从而打破这种技术。

MKMapView 有 2 个子视图。其中之一是 UIImageView,它出于版权目的而保存“Google”图像。

因此,在 IB 中,您可以设置位于左下角的自己的 UIImageView,并且在代码中您可以将其图像设置为与地图视图内的 UIImageView 中的图像相同:

-(void) getImage {
    for(UIView *v in mapView.subviews) {

        if([v isKindOfClass:[UIImageView class]]) {
            NSLog(@"%@",v);
            self.cpyView.image=((UIImageView *)v).image;
        }
    }

}

现在,当您旋转 MKMapView 时,您的 UIImageView不会被旋转。

现在,这里的另一个技巧是将 MKMapView 嵌入到另一个视图 (viewForMap) 中(这个想法借自 Wei-Meng Lee 的 Beginning iOS 4)。

将 UIView 放入 IB 中,并将其调整为您想要的可见地图的大小。将其设置为剪辑 IB 中的子视图。

在代码中,您将分配] initWithFrame 一个 MKMapView ,以便 MKMapView 位于此 viewForMap 的中心,但比它大。

例如,如果您的 viewForMap 是 320、372,则执行以下操作:

mapView=[[MKMapView alloc] initWithFrame:CGRectMake(-90,-64,500,500)];
mapView.mapType=MKMapTypeHybrid;
mapView.delegate=self;
[viewForMap addSubview:mapView];

现在您可以旋转地图 mapView.transform=CGAffineTransformMakeRotation(-M_PI/2);

保存“Google”图像的 UIImageView不会旋转,因此它保持可见。 MKMapView 内的“Google”图像将不在屏幕上。

So I've figured out a way to do this, although I still feel its a bit of a hack because Apple could change things in future releases that will break this technique.

MKMapView has 2 subviews. One of them is a UIImageView that holds the "Google" image for copyright purposes.

So in IB you can setup your own UIImageView that sits at the lower left corner, and in code you can set its image to be the same image as the one in the UIImageView inside the map view:

-(void) getImage {
    for(UIView *v in mapView.subviews) {

        if([v isKindOfClass:[UIImageView class]]) {
            NSLog(@"%@",v);
            self.cpyView.image=((UIImageView *)v).image;
        }
    }

}

Now when you rotate your MKMapView, your UIImageView won't get rotated.

Now the other trick here is to have the MKMapView embeded in another view (viewForMap) (idea borrowed from Beginning iOS 4 by Wei-Meng Lee).

Drop a UIView into IB and size it to the size you want the visible map to be. Set it to clip sub views in IB.

In code you'll alloc] initWithFrame an MKMapView so that the MKMapView sits centered on this viewForMap, but is larger than it.

For example, if your viewForMap is 320, 372, then do this:

mapView=[[MKMapView alloc] initWithFrame:CGRectMake(-90,-64,500,500)];
mapView.mapType=MKMapTypeHybrid;
mapView.delegate=self;
[viewForMap addSubview:mapView];

Now you can rotate your map mapView.transform=CGAffineTransformMakeRotation(-M_PI/2);

Your UIImageView that is holding the "Google" image won't get rotated so it stays visible. The "Google" image inside the MKMapView will be off screen.

扮仙女 2024-10-13 16:26:58

您可以这样做:

  1. 在任何图像编辑程序中制作图片“Google”徽标。
  2. 增加 MKMapView 的大小,这样就看不到徽标了。
  3. 将图片的子视图添加到 MKMapView。

如果您不使用 Google 徽标,您的申请将根据以下情况被拒绝:

8.6 如果原始内容的所有品牌特征保持不变,则可以在应用程序中使用通过 Google Maps API 获取的 Google 地图和 Google 地球图像并且完全可见。掩盖或修改 Google 徽标或版权所有者标识的应用程序将被拒绝

最重要的是,使用此:http ://wiki.openstreetmap.org/wiki/iPhone

You can do this:

  1. Make a picture "Google" logo in any image editing program.
  2. Increase the size of your MKMapView, that would not have seen the logo.
  3. Add a subview of your picture to MKMapView.

If you'll do without the logo of Google, your application will be rejected according to the following:

8.6 Google Maps and Google Earth images obtained via the Google Maps API can be used within an application if all brand features of the original content remain unaltered and fully visible. Apps that cover up or modify the Google logo or copyright holders identification will be rejected

And best of all, use this: http://wiki.openstreetmap.org/wiki/IPhone

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