I am making an iPhone app that is designed for things that will be local to only Missouri. So my idea is to limit the map to only Missouri/regions close to Missouri. I have the map working fine, displaying the user's location, and if they update location then the pin will also move. Can I use something like a Custom Annotation to do this? Or can I check the users location and decide if its withing a certain lat, long and display the map based on that?
我正在制作一款专为只有密苏里州本地人设计的iPhone应用程序。所以我的想法是将地图限制在密苏里州附近的密苏里州/地区。我让地图工作正常,显示用户的位置,如果他们更新位置,那么引脚也会移动。我可以使用自定义注释之类的东西来执行此操作吗?或者我可以检查用户位置并确定它是否具有某个纬度,长并显示基于此的地图?
I am working in xCode while making this project.
我在制作这个项目时正在使用xCode。
2 个解决方案
#1
1
Take a look at the MKMapViewDelegate protocol. There are methods there that will inform you when the user's location has changed and when the map has been moved. You can then do what is appropriate depending on where the user is.
看看MKMapViewDelegate协议。当用户的位置发生变化以及地图移动时,有一些方法可以通知您。然后,您可以根据用户的位置执行适当的操作。
#2
1
Set the exact area that you wish to display on your map, using MKMapView's
region
and centerCoordinate
properties. Then, disable scrolling and zooming using zoomEnabled
and scrollEnabled
of the same class.
使用MKMapView的region和centerCoordinate属性设置您希望在地图上显示的确切区域。然后,使用同一类的zoomEnabled和scrollEnabled禁用滚动和缩放。
#1
1
Take a look at the MKMapViewDelegate protocol. There are methods there that will inform you when the user's location has changed and when the map has been moved. You can then do what is appropriate depending on where the user is.
看看MKMapViewDelegate协议。当用户的位置发生变化以及地图移动时,有一些方法可以通知您。然后,您可以根据用户的位置执行适当的操作。
#2
1
Set the exact area that you wish to display on your map, using MKMapView's
region
and centerCoordinate
properties. Then, disable scrolling and zooming using zoomEnabled
and scrollEnabled
of the same class.
使用MKMapView的region和centerCoordinate属性设置您希望在地图上显示的确切区域。然后,使用同一类的zoomEnabled和scrollEnabled禁用滚动和缩放。