当您转动手机时,iPhone 3G 上的地图应用程序如何旋转?

发布于 2024-08-17 16:36:47 字数 604 浏览 3 评论 0原文

在 iPhone 3G 上,如果您单击窗口左下角的小“显示我的位置”符号两次,它会切换到导致地图旋转的模式,以便地图上的北方根据指南针指向北方。我没有3G,所以我是从一个有3G的朋友那里得知这一消息的。

我尝试将旋转变换应用于 MKMapView 的图层,如下所示:

CATransform3D rotationTransform = CATransform3DIdentity;  
rotationTransform = CATransform3DRotate(rotationTransform, degreesToRadians(-20), 0.0, 0.0, 1.0);  
theMapView.layer.transform = rotationTransform;

有点有效,但实际上并非如此。地图的内容确实会旋转,但框架会旋转并拉伸。地图视图最终形成一条在屏幕上对角延伸的条带,并且最终位于我视图中的按钮下方。

我尝试将地图包含在另一个视图中以将其隔离,但这也不起作用。接下来我将尝试旋转封闭视图,但我希望其他人已经解决了这个问题。通过反复试验让它发挥作用可能是很困难的。

问候,

邓肯 C

On an iPhone 3Gs, if you click the little "show my location" symbol on the lower left of the window twice, it switches to a mode that causes the map to rotate so that north on the map faces towards north according to the compass. I don't have a 3Gs, so I just found out about this from a buddy who does have one.

I tried applying a rotation transformation to a MKMapView's layer, like this:

CATransform3D rotationTransform = CATransform3DIdentity;  
rotationTransform = CATransform3DRotate(rotationTransform, degreesToRadians(-20), 0.0, 0.0, 1.0);  
theMapView.layer.transform = rotationTransform;

That sort of works, but not really. The contents of the map do rotate, but the frame rotates and stretches. The map view ends up in a strip that stretches diagonally across the screen, and it ends up under the buttons in my view.

I tried enclosing the map in another view to isolate it, but that doesn't work either. Next I'll try rotating the enclosing view, but I'm hoping somebody else has figured this out. Getting it to work by trial and error is likely to be difficult at best.

Regards,

Duncan C

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

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

发布评论

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

评论(1

断肠人 2024-08-24 16:36:47

我有同样的问题。我能够通过将 MkMapView 放置在 UIView 容器中来解决拉伸问题。

I have the same problem. I was able to solve the stretching by placing the MkMapView in a UIView container.

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