mkmapviewdelegate

How to suppress the “Current Location” callout in map view

若如初见. 提交于 2019-12-03 10:37:47
Tapping the pulsating blue circle representing the userLocation brings up a "Current Location" callout. Is there a way to suppress that? jowie There's a property on the annotation view you can change, once the user location has been updated: - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { MKAnnotationView *userLocationView = [mapView viewForAnnotation:userLocation]; userLocationView.canShowCallout = NO; } You can set the title to blank to suppress the callout: mapView.userLocation.title = @""; Edit: A more reliable way might be to blank the title in

Make MKMapView only zoom in on the centerCoordinate?

匆匆过客 提交于 2019-12-02 20:12:06
问题 I have a MKPinAnnotationView that is always in the center of the map. When panning and zooming the pin gives me the center coordinates (lat/long) of the map. Currently when you zoom in, it just zooms into wherever your directing the map to zoom into. I'd really like to lock the zoom onto the pin. Any ideas on how I'd achieve this? 回答1: Assuming by MKPinAnnotation you mean MKPinAnnotationView, you can access the annotation's coordinate and use that to create a region and subsequently set the

Make MKMapView only zoom in on the centerCoordinate?

烈酒焚心 提交于 2019-12-02 09:00:06
I have a MKPinAnnotationView that is always in the center of the map. When panning and zooming the pin gives me the center coordinates (lat/long) of the map. Currently when you zoom in, it just zooms into wherever your directing the map to zoom into. I'd really like to lock the zoom onto the pin. Any ideas on how I'd achieve this? Assuming by MKPinAnnotation you mean MKPinAnnotationView, you can access the annotation's coordinate and use that to create a region and subsequently set the region of the mapView to that region centered on the coordinate: MKCoordinateRegion region =

Custom font for MKAnnotationView Callout

老子叫甜甜 提交于 2019-12-02 01:14:50
Fortunately, the standard callout view for an MKAnnotationView meets our needs - title , subtitle , leftCalloutAccessoryView , and rightCalloutAccessoryView . Unfortunately, we use custom fonts in our app, and would like to extend those custom fonts to these callouts. MKAnnotationView provides no standard way to accomplish this. How can I use a custom font in an MKAnnotation 's callout view? Since I needed the Swift version - here it is. Also, you have to call setNeedsLayout() on didAddSubview() because otherwise when you deselect and reselect the annotation layoutSubviews() is not called and

Swift 2 MKMapViewDelegate rendererForOverlay optionality

六眼飞鱼酱① 提交于 2019-12-01 16:34:27
In Swift 1.2 I have this: class UVC: NSViewController, MKMapViewDelegate { // ... // ************************************** // MARK: MapView Delegate // ************************************** func mapView(mapView: MKMapView, rendererForOverlay overlay: MKOverlay) -> MKOverlayRenderer! { if overlay is OSGBTiles { return OSGBTilesRenderer(tileOverlay: overlay as! OSGBTiles) } else if overlay is ESRI { return ESRIRenderer(shapeFileOverlay: overlay as! ESRI) } else if overlay is MKTileOverlay { return MKTileOverlayRenderer(overlay: overlay) } else { print("Unknown overlay") } return nil } } Swift

Swift 2 MKMapViewDelegate rendererForOverlay optionality

和自甴很熟 提交于 2019-12-01 15:59:10
问题 In Swift 1.2 I have this: class UVC: NSViewController, MKMapViewDelegate { // ... // ************************************** // MARK: MapView Delegate // ************************************** func mapView(mapView: MKMapView, rendererForOverlay overlay: MKOverlay) -> MKOverlayRenderer! { if overlay is OSGBTiles { return OSGBTilesRenderer(tileOverlay: overlay as! OSGBTiles) } else if overlay is ESRI { return ESRIRenderer(shapeFileOverlay: overlay as! ESRI) } else if overlay is MKTileOverlay {

Detecting when MapView tiles are displayed

房东的猫 提交于 2019-12-01 04:19:02
Since - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView is not called when the tiles are loaded from cache, is there a way to know when all the tiles have been loaded (either from cache or from the mapping servers) and displayed? Is there any delegation that intimates that tiles have been loaded ? Here is some source code I wrote: https://github.com/jonathanlking/mapViewTest Why don't you think about the problem like this; When the map view will change, mapView:regionDidChangeAnimated: will be called. From there mapViewWillStartLoadingMap: will be called. Next mapViewDidFailLoadingMap

In which case that mapView:viewForAnnotation: will be called?

爷,独闯天下 提交于 2019-11-29 07:48:33
Now I want to add a static pin annotation on map in my iOS app. But I just want to know if the delegate method mapView:viewForAnnotation: will be called. In the Apple documentation, it is said that When it needs an annotation view, the map view calls the mapView:viewForAnnotation: method of its delegate object. I have read several tutorials from Internet and official documentation from Apple. And I still don't when this method will be called. Whenever you call addAnnotation method - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id < MKAnnotation >)annotation gets called.

In which case that mapView:viewForAnnotation: will be called?

旧巷老猫 提交于 2019-11-28 01:35:57
问题 Now I want to add a static pin annotation on map in my iOS app. But I just want to know if the delegate method mapView:viewForAnnotation: will be called. In the Apple documentation, it is said that When it needs an annotation view, the map view calls the mapView:viewForAnnotation: method of its delegate object. I have read several tutorials from Internet and official documentation from Apple. And I still don't when this method will be called. 回答1: Whenever you call addAnnotation method -