mapkit

How to rotate Apple map in driving direction in ios?

╄→гoц情女王★ 提交于 2019-12-01 13:44:08
I want to rotate apple map based on user's driving direction, Any idea or solution to rotate map like that way? I can collect array of last 5-10 moved location, but based on it, Can I calculate heading or anything else to rotate map? 来源: https://stackoverflow.com/questions/57232437/how-to-rotate-apple-map-in-driving-direction-in-ios

MKMapView constantly monitor heading

落爺英雄遲暮 提交于 2019-12-01 13:35:39
I'm rendering some content in a layer that sits on top of my MKMapView . The whole thing works great with the exception of rotation. When a user rotates the map I need to be able to rotate what I'm rendering in my own layer. The standard answer I found is to use: NSLog(@"heading: %f", self.mapView.camera.heading"); The issue with this is that the content of the heading variable only updates when the pinch/rotate gesture is ending, not during the gesture. I need much more frequent updates. There is no heading property on the mapView itself. I thought maybe using KVO like such: // Somewhere in

Problems accessing custom MKAnnotation data via rightCalloutAccessoryView

我是研究僧i 提交于 2019-12-01 13:14:13
问题 I am trying to access some custom data I've setup in my custom annotation data when triggered by the rightCalloutAccessoryView. I am getting a compiler error as described below. Here's my custom MKAnnotation with a couple of extra variables - status & supplierdataindex class CustomMapPinAnnotation : NSObject, MKAnnotation { var coordinate: CLLocationCoordinate2D var title: String var subtitle: String var status: Int var supplierdataindex: Int init(coordinate: CLLocationCoordinate2D, title:

how to change pin color in mapkit under the same annotationview (swift3)

别等时光非礼了梦想. 提交于 2019-12-01 13:04:17
问题 I have 2 pins in mapkit, both are under the same annotation view so it makes since that both of the pins are the same color. How can I make the pins different colors. I would like hello to be red and hellox to be blue. import UIKit import MapKit class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet var jmap: MKMapView! override func viewDidLoad() { jmap.delegate = self; let hello = MKPointAnnotation() hello.coordinate = CLLocationCoordinate2D(latitude: 40, longitude: -73) jmap

Passing data from annotations to detail view iOS using storyboard

一世执手 提交于 2019-12-01 13:04:00
问题 I'm trying to pass the data that I have currently loaded into annotations via Google Places API into a detail view controller that I have created via storyboard with a segue. I have it properly loading the detail view controller upon clicking the detail disclosure on each annotation, but I'm trying to get the data passed now. - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { // Assuming I call the MapPoint class

How to clear the cache of mkmapview

試著忘記壹切 提交于 2019-12-01 12:49:00
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 address which is already search.It again created a new pin. I know this is coming from cache of

Hiding mapview when mapoverlay is visible ios7

白昼怎懂夜的黑 提交于 2019-12-01 11:59:27
How do I hide the mapview when I have an overlay on top of the mapview in iOS7? This snippet of code used to work in iOS6 but when i upgrade my app to iOS7 it cease to work. NSArray *views = [[[self.mapView subviews] objectAtIndex:0] subviews]; [[views objectAtIndex:0] setHidden:YES]; Any suggestions or feedback? huggie With what incanus said with MKTileOverlay , it is like this in the view controller: - (void)viewDidLoad { [super viewDidLoad]; NSString *tileTemplate = @"http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg"; MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate

Custom Annotation View do not work on iOS6

梦想与她 提交于 2019-12-01 11:47:09
I'm using the J4n0 Callout code ( github ) to implement a custom annotation in MapKit. It was working just fine on iOS5. But on iOS6 I have 2 problems: Annotations are displayed over the AnnotationView (see picture 1). The first Click on an Annotation opens the AnnotationView just fine, but the second click opens an annotation with a bad size (see picture 2). Does anyone using this library have some similar problem/solution? I can give some code if needed! Sibear If annotations are displayed over the AnnotationView try to code: - (void)didMoveToSuperview { [super didMoveToSuperview]; [self

Longer subtitles in MapView annotations (swift)

吃可爱长大的小学妹 提交于 2019-12-01 11:36:12
I have a mapView with annotations displaying titles and subtitles. The subtitles are sometimes longer than the width of the annotation, so I am wondering if i can make them multiline? It's coded like this so far: func annotate(newCoordinate, title: String, subtitle: String) { let annotation = MKPointAnnotation() annotation.coordinate = newCoordinate annotation.title = title annotation.subtitle = subtitle self.map.addAnnotation(annotation) } Then i have a few options set in func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {...} which are not

iOS JSON Array and MapKit

流过昼夜 提交于 2019-12-01 11:18:54
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","lat":"21.306","lon":"-157.861"}, {"id":"2","name":"Bills Oil","lat":"21.301","lon":"-157.863"},{"id":