将 GPS 当前位置和图钉注释放在 UIImageView 上
我正在为当地一所大学制作 iPhone 应用程序。我目前正在尝试绘制一张校园地图并在上面添加图钉注释。我还希望能够在此地图图像上向用户显示当前位置。现在我只有一个 UIScrollView 里面有一个 UIImageView 。目前它可以滚动和放大/缩小。我将如何实现这一目标?我到处寻找答案,但似乎找不到解决方案(或忽略了它)。我的方向正确吗?感谢您的帮助。
I am making an iPhone app for a local college. I am currently trying to take a drawn map of the campus and put pin annotations on it. I also want to be able to show the users current location on this map image. Right now I just have a UIImageView inside of a UIScrollView. It can currently scroll and zoom in/out. How would I go about accomplishing this? I have searched everywhere for an answer and can't seem to find a solution (or have overlooked it). Am I going in the right direction? Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须想出一个函数将纬度和经度转换为图像中的像素偏移量。假设校园与地球相比相对较小(因此您可以忽略地球的曲率),这应该是确定图像四个角的坐标并进行插值的简单问题。
You would have to come up with a function to translate latitude and longitude into pixel offsets in the image. Assuming the campus is relatively small compared to the Earth (so you can ignore the planet's curvature), this should be a simple matter of determining the coordinates of the four corners of the image and interpolating.