mapkit

Calculating Distance iOS MapKit Using CLLocation

二次信任 提交于 2020-01-01 12:15:43
问题 I am trying to find the distance in miles using the latitude and longitude. I have the following method: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { if(!newLocation) return; if ((oldLocation.coordinate.latitude != newLocation.coordinate.latitude) && (oldLocation.coordinate.longitude != newLocation.coordinate.longitude)) { CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:oldLocation

How to draw route between two locations and plot main points also using MapKit?

[亡魂溺海] 提交于 2020-01-01 03:53:25
问题 I am using MapKit api to get current location on map and drawing route between two location pointed by drop pins.I also want to get all the main stands between its route. I m using below function to get route between two location - (NSArray*)getRoutePointFrom:(MyLocation*)origin to:(MyLocation*)destination { NSString* saddr = [NSString stringWithFormat:@"%f,%f", origin.coordinate.latitude, origin.coordinate.longitude]; NSString* daddr = [NSString stringWithFormat:@"%f,%f", destination

Updating MKannotation image without flashing

陌路散爱 提交于 2020-01-01 00:47:09
问题 I want to update the images of some of my annotations on a mapview every 5 seconds, however I dont' want to remove and re-add them to the map as this causes them to 'flash' or refresh, (ie disapear then reappear). I want it to be seamless. I've tried the following: //get the current icon UserAnnotation *annotation = [self GetUserIconWithDeviceId:deviceId]; //make a new annotation for it UserAnnotation *newAnnotation = [[UserAnnotation alloc] initWithCoordinate: userCoordinates

iOS: Notification when MKMapView is loaded and annotations/overlays are added?

我只是一个虾纸丫 提交于 2019-12-31 18:42:29
问题 I am aware of the delegate methods used to let me know when the map has loaded and annotations and overlays have been added. ( mapViewDidFinishLoadingMap: mapView:didAddAnnotationViews: mapView:didAddOverlayViews: ) I am wanting to create a UIImage from my MKMapView once everything has loaded. Currently I am creating my UIImage once mapView:didAddOverlayViews: is called, but this is not always reliable, because sometimes the overlay take longer to be added, sometimes

iOS 10 MapKit previous layer zoom issue

ε祈祈猫儿з 提交于 2019-12-31 13:55:14
问题 I am working in a map application which renders a polyline over a map. I am having an issue when zooming, it keeps the previous polyline on the tile. I have tried to force redrawing: [self.mapView reloadInputViews]; [self.mapView.layer setNeedsDisplay]; [self.mapView setNeedsDisplay]; Also I tried to slow the zoom speed, but the issue is still in there: [MKMapView animateWithDuration:2 delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:10 options:UIViewAnimationOptionCurveEaseOut

Apple MapKit 3D flyover

試著忘記壹切 提交于 2019-12-31 08:42:29
问题 Is there any public iOS 8 API available to implement 3D flyover or at least 3D view as shown on Apple Maps App screenshot below? Update After below suggestions I've done following code: import UIKit import MapKit class ViewController: UIViewController { @IBOutlet weak var mapView: MKMapView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. mapView.showsBuildings = true let eiffelTowerCoordinates =

Apple MapKit 3D flyover

南笙酒味 提交于 2019-12-31 08:42:28
问题 Is there any public iOS 8 API available to implement 3D flyover or at least 3D view as shown on Apple Maps App screenshot below? Update After below suggestions I've done following code: import UIKit import MapKit class ViewController: UIViewController { @IBOutlet weak var mapView: MKMapView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. mapView.showsBuildings = true let eiffelTowerCoordinates =

MKMapView centerCoordinate not exact

孤街浪徒 提交于 2019-12-31 05:45:05
问题 When I try to place a pin in the center of the map using MKMapView's centerCoordinate it puts a pin roughly in the center, but it's several pixels south of the true center of the map. I tried converting the map's center point to a coordinate MKMapView.convertPoint(MKMapView.center) and that worked perfectly on ios8 but on ios7 is still off (now its south and west of the true center). Anyone know how to determine how "off" the center coordinate is so I can adjust? I need this because I am

How to get Apple Maps App (not MapKit) to add an annotation?

て烟熏妆下的殇ゞ 提交于 2019-12-31 03:57:29
问题 It's quite easy to add an annotation to a MapKit view which is inside your app . theMap: MKMapView! let pa = MKPointAnnotation() pa.title = "title!!" etc theMap.addAnnotation(pa) But how the heck do you make the Maps App add an annotation?? Here's exactly how to open the Maps App to a certain address.. func appleMapApp() { quickAddressText = "123 Smith St 90210" let bottomText = "This shows at BOTTOM Of Maps App screen." let g = CLGeocoder() g.geocodeAddressString(quickAddressText) {

Hiding and disabling user interaction on a MapKit pin?

蹲街弑〆低调 提交于 2019-12-31 03:16:06
问题 I'm trying to hide a pin on a MapKit view, and while setting the hidden property to YES works, I can still tap on it and get didSelectAnnotationView messages!. Naturally, I tried setting userInteractionEnabled to NO , but I'm still receiving the messages. This is what I've tried. a is my annotation view. a.hidden = YES; a.layer.hidden = YES; a.userInteractionEnabled = NO; There's something that I'm missing here, and I've Googled everywhere and can't find anything that works. Any clues? 回答1: