mapkit

How to clear the cache of mkmapview

跟風遠走 提交于 2019-12-01 10:55:19
问题 In my app.I have a one textfield and one search button.when it user click on search button after fill up the address on textfield my app shows the result and place a pin on mapview. I am using google maps api for it. I have also added the functionality user can drag and drop the pin. when the user drag the pin and drop on another place.The previous pin should be removed.For removing that pin i am using [mapView removeAnnotation[mapView.annotations lastObject]]; but when i again search a new

iOS MapKit show nearest annotations within certain distance

自古美人都是妖i 提交于 2019-12-01 10:30:13
问题 Currently i am working on a Location based application for iPhone/iPad . I have several annotations in my MapKit , what i want to do is to track the location of the user and shows the annotations that are within the 3km . Can somebody give me a start ? 回答1: Sorry for the delayed response... the question just fell off my radar. I'm going to suppose that you have a method that returns a set of NSValue-wrapped CLLocationCoordinate2D structs (the basic approach is the same regardless of what your

How to Increase the Radius of userLocation Annotation in Mapkit

拟墨画扇 提交于 2019-12-01 10:26:16
问题 My app takes user permission and move the map to the location. And at that position by default MapKit add a blue icon which is generating some pulse. I've searched around but I found how to add a 1000m circle around userLocation . I don't want that. You can say I'm looking to customize the userLocation default annotation . The blue pulse it generates I want to increase that radius . And when this blue pulse hits a custom annotation there should be a method triggered. So how to achieve that?

Calculate area of MKPolygon in an MKMapView

自闭症网瘾萝莉.ら 提交于 2019-12-01 09:47:04
I just don't know how to calculate the area on the MKMapView. Anyone who has solved this problem yet? This is my code, but it returns way too much: func ringArea() -> Double{ var area: Double = 0 if templocations.count > 2 { var p1,p2:CLLocationCoordinate2D for var i = 0; i < templocations.count - 1; i++ { var loc = templocations[i] as CLLocation p1 = CLLocationCoordinate2D(latitude: loc.coordinate.latitude, longitude: loc.coordinate.longitude) loc = templocations[i+1] as CLLocation p2 = CLLocationCoordinate2D(latitude: loc.coordinate.latitude, longitude: loc.coordinate.longitude) var sinfunc:

How to add two or more buttons to annotationView: MKAnnotationView?

不想你离开。 提交于 2019-12-01 08:35:14
I want to have a MKAnnotationView to my pins on map (using MapKit) with next attributes: 1) image 2) details button 3) another details button 4) another details button? I have done actually adding image and details button with next code: annotationView.detailCalloutAccessoryView = snapshotView // snapshot view is a custom view // with image and its constraints let detailsButton = UIButton(type: .detailDisclosure) annotationView.rightCalloutAccessoryView = detailsButton So, the question is how to add more than one button to MKAnnotationView ? Because all the tutorials that I've ever seen only

crash on setUserTrackingMode with MKMapView when zoomed in

瘦欲@ 提交于 2019-12-01 08:24:02
I have MKMapView with MKUserTrackingModeFollowWithHeading. But something changes the userTrackingMode to MKUserTrackingModeFollow or None, so I implemented, - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated { if ([CLLocationManager locationServicesEnabled]) { if ([CLLocationManager headingAvailable]) { [self.myMapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO]; }else{ [self.myMapView setUserTrackingMode:MKUserTrackingModeFollow animated:NO]; } }else{ [self.myMapView setUserTrackingMode

iOS JSON Array and MapKit

独自空忆成欢 提交于 2019-12-01 07:48:56
问题 I am trying to map a JSON array using the MapKit. I can get a single point on the map with the code below, but I have dozens of pins I need to mark, and I have a JSON array prepared. My code for a single point is below. In my .h file: #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewController : UIViewController { MKMapView *mapView; NSData *data; } @property (nonatomic, retain) IBOutlet MKMapView *mapView; @end In my .m file: NSData *data = @"[{"id":"1","name":"Jiffy Lube"

Is there a way to get directions(just routes) using google for mkmapview?

时光总嘲笑我的痴心妄想 提交于 2019-12-01 07:41:09
问题 I'm using swift on iOS and using MKMapView. I've been working on giving a user a from - to textfield and letting the user have a form of route between the from and to locations. I've got that working on mkmapview using the built in directions and geocoding api calls for Apple. However after using it for a while a realized that a lot of countries are not supported by Apple Apple - Supported Countries For Directions So is there a way to get routes from the google maps SDK and translate them to

crash on setUserTrackingMode with MKMapView when zoomed in

别说谁变了你拦得住时间么 提交于 2019-12-01 07:38:08
问题 I have MKMapView with MKUserTrackingModeFollowWithHeading. But something changes the userTrackingMode to MKUserTrackingModeFollow or None, so I implemented, - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated { if ([CLLocationManager locationServicesEnabled]) { if ([CLLocationManager headingAvailable]) { [self.myMapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO]; }else{ [self.myMapView setUserTrackingMode

How to trigger a video when a user reaches a certain location?

你说的曾经没有我的故事 提交于 2019-12-01 07:09:26
问题 This is my CoreLocationController.h objective c class #import <Foundation/Foundation.h> #import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h> extern const CLLocationAccuracy kCLLocationAccuracyBest; @protocol CoreLocationControllerDelegate @required - (BOOL)startRegionMonitoring; - (void)locationUpdate:(CLLocation *)location; // Our location updates are sent here - (void)locationError:(NSError *)error; // Any errors are sent here @end @interface CoreLocationController : NSObject