问题
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