MKMapView 旋转的经验
我有一个 MKMapView,我正在考虑旋转它,以便更方便地向用户显示一系列注释。
截至目前,我计划简单地使用 CGAffineTransform 旋转整个视图,但我想知道是否有人有 MKMapView 旋转的经验。
- 添加旋转时您是否遇到过任何陷阱或“陷阱”?
- 有没有更简单的方法来旋转地图视图?
- 如果我有一个覆盖层,convertCooperative:toPointToView:方法仍然会以同样的方式工作吗?我假设我必须对叠加层应用相同的变换才能使点对齐,但也许该方法比这更聪明。
如果您认为有什么可以帮忙的,我很乐意听听。
编辑:经过多次实验,我相信我将使用可以自己旋转和覆盖的静态地图,但是,我仍然对有关 MKMapView 旋转的任何信息感兴趣。
I have an MKMapView that I am considering rotating in order to more conveniently display a series of Annotations to my users.
As of now I am planning on simply rotating the entire view with a CGAffineTransform, but I wanted to know if anyone had any experience with MKMapView rotation.
- Are there any pitfalls or "gotchas" that you came across when adding rotation?
- Is there an easier way to rotate a mapview?
- If I have an overlay will the convertCoordinate:toPointToView: method still work the same way? I would assume that I'd have to apply the same transform to my overlay for the points to line up, but maybe the method is smarter than that.
If there's anything that you think could help out I'd love to hear it all.
Edit: After much experimentation I believe that I'll be using static maps that I can rotate and overlay myself, however, I would still be interested in any information about MKMapView rotation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我还计划在我的应用程序中使用旋转的 MKMapView。为了显示未旋转的注释,我使用以下代码:
它似乎对我有用。
I also plan to use rotated MKMapView in my application. To show annotations unrotated I use the following code:
It seems to work for me.
很抱歉重温一个已完成的主题,但还有一个“陷阱”:如果您将地图视图调整得足够大以进行旋转,以便它始终覆盖整个屏幕,那么您最终会从左下角裁剪“Google”徽标。这明显违反了您使用 MapKit 所依据的许可,并且可能成为应用程序被拒绝的理由。在实践中,在顶部添加静态版本的 Google 徽标作为 UIImageView 似乎是各方都可以接受的。
Sorry to revive a finished topic, but one more 'gotcha': if you size your map view to be large enough to rotate so that it always covers the entire screen then you'll end up cropping the 'Google' logo from the bottom left. This is explicitly contrary to the licence under which you use MapKit and may be grounds for an app rejection. In practice, adding a static version of the Google logo as a UIImageView on top seems to be considered acceptable by all parties.
这是 MKMapView 使用 iPhone 旋转的新鲜示例加速度计。希望它会有所帮助。
That's a fresh sample of MKMapView rotation with iPhone ccelerometer. Hope it'll help.
我开始使用 MKMapView 旋转并发现:
I started working with MKMapView rotations and have found that: