Change map type of an MKMapView

[亡魂溺海] 提交于 2019-12-10 17:17:38

问题


I'm trying to develop an interface for the user to change mapType views. I'd like to implement this by adding a fold effect to the bottom-right corner of the mapview where the user can press or press and drag in the bottom-right corner and the map will fold up just enough to reveal the 3 different mapTypes: regular, hybrid, and satellite.

This is the same functionality that google maps on the iPhone has. Load the app and notice the 'paper-folding' button in the lower right corner. Press it and witness the effects. This is what I'm trying to accomplish.

Is there a method to be able to do this? If not, what may be another way to implement this functionality.


回答1:


The WorldCities sample code from the Apple library uses that implementation and should be a great place to learn how to switch map types. MapViewController.m in particular gives the specifics on it. As far as getting the curl you are looking for, presenting a modal view controller with your (map type switching controller) using UIModalTransitionStylePartialCurl will do just that. I hope this helps




回答2:


When you are using another controller, it is not possible to link directly to the first view controller's MKMapView and change the map type of it. Someone told me to use NSNotification, but I still don't know how to do it.



来源:https://stackoverflow.com/questions/6171048/change-map-type-of-an-mkmapview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!