mapkit

Toggling MapKit Overlays On/Off by pressing the same button?

北城以北 提交于 2019-12-24 00:48:35
问题 I have a MapView with a toolbar button that when pushed adds overlays to the MapView. What I would like is for the button (IBAction) to check to see if there already are overlays on the map and if there are remove, if there are not, to add them. My current code that adds the overlays is as follows: - (IBAction)waterWaysAction:(id)sender { NSLog(@"WaterWays pushed"); if ([mapView overlays]) { [mapView removeOverlays:[mapView overlays]]; NSLog(@"WaterWays removed"); } else { // ******* adds the

Bug with MKMapView's centerCoordinate during rotation?

泪湿孤枕 提交于 2019-12-24 00:16:32
问题 I think I may have found a bug in MKMapView , but I'd like to run it by folks to see if anyone else has run into this issue. I'm using iOS 7 and Xcode 5. In my storyboard, I have a view controller with an MKMapView in it. My app allows rotation to both portrait and landscape. I am using autolayout to keep the frame of the MKMapView updated when the user rotates the device. After rotation, it appears that MKMapView is reporting an incorrect centerCoordinate in the regionDidChangeAnimated

Reading JSON from URL and adding MKAnnotations

一笑奈何 提交于 2019-12-23 22:51:31
问题 I've been through several different tutorials trying to get this working, but they seem to gloss over some crucial steps that a beginner might not know. I have a JSON file at a URL with name, latitude, and longitude listed. How can I import that to an array or dictionary (I don't know the difference), and then iterate over it and create a new annotation with each iteration. IOS6, Storyboards _ Added Code _ ViewController.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface

How can I tell when an MKOverlay is no longer within view?

孤街浪徒 提交于 2019-12-23 20:23:00
问题 MKMapViewDelegate's mapView:rendererForOverlay fires when an MKOverlay 's boundingMapRect enters the visible bounds of the MKMapView . Is there an equivalent delegate method that is fired when the MKOverlay leaves the map view's visible bounds? Or do I have to do this math myself? 来源: https://stackoverflow.com/questions/23147789/how-can-i-tell-when-an-mkoverlay-is-no-longer-within-view

Sharing a mkmapview screenshot

大憨熊 提交于 2019-12-23 20:02:02
问题 I have a map with lots of stuff on it, which I'd like to share in form of a picture/screenshot. However, as far as i know, the map --both iOS 6 for Apple and iOS 5 for Google-- is copyrighted and I can't simply do that. I thought of Google Static Maps API, but I didn't find something similar for the Apple maps to be available. How could I share a mapview picture without violating their rules and still using the MapKit framework ? Thanks! 回答1: I'm struggling myself with laws of sharing Apple

Mapkit issue in finding annotation current position

霸气de小男生 提交于 2019-12-23 17:08:39
问题 I am implementing map kit in my app and i am using this first time so please tell me how to find the current position of the annotation.? 回答1: To add annotations to MapKit you need to implement an Annotation Delegate which implements the MKAnnotation protocol. When you add the annotation to the map you create an instance of you Annotation Delegate object and then add it to the MKMapView . MKAnnotation includes a position property which you can query to determine the location of the annotation

Detect on calloutAccessoryControlTapped only the tap on rightCalloutAccessoryView

拈花ヽ惹草 提交于 2019-12-23 07:03:37
问题 My calloutAccessoryControlTapped is also called when I just tap on annotation view and this behavior it's right. But how can I detect if the user has tapped on the right accessory view (in my case a detail disclosure button) and not just in the view? I added a simple check but it doesn't work. import UIKit import MapKit extension MapVC: MKMapViewDelegate, CLLocationManagerDelegate { func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control:

How to add a customView xib as annotation in Ios?

血红的双手。 提交于 2019-12-23 05:47:09
问题 when i am using googlemaps all I have to do is let marker = GMSMarker() marker.position = postions.target marker.title = "TEST" marker.map = self.mapView let myCustomView:CustomView = UINib(nibName: "CustomView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! CustomView marker.iconView = myCustomView but if i am using MAPKIT, how will I achieve this.? Mycustomview is a xib view file i created. 回答1: Try to add the object of the nib view to the annotation view like this func

iPhone: mapView.showUserLocation. VS locationUpdate function

↘锁芯ラ 提交于 2019-12-23 05:07:12
问题 I'm developing on an app that is location-based, I have a mapView set to show the user location (mapView.showUserLocation); I also have a locationUpdate function to retrieve lat/long of current position: (void)locationUpdate:(CLLocation *)location{} After I call the function stopUpdatingLocation to stop the update location, the mapview (blue ball) continues to update my location... In other word: is there another locationUpdate function is called automatically from the mapview? 回答1: I think

How to determine the next POI in a navigation route?

白昼怎懂夜的黑 提交于 2019-12-23 04:45:27
问题 I have a route ( MKPolyline derived from an MKRoute retrieved from Apple's MKDirections API) and a bunch of points of interest (array of MKAnnotation s) that are close to the route. I would like to know how to select the next POI the user is going to meet following the route, in order to present it through a UI. Two different approaches come to mind, but none of them is really adequate: The first one would be to mark the POIs as checked each time you get close enough to them, and simply