mapkit

iOS Mapkit - Annotations disappear on map scroll/zoom

扶醉桌前 提交于 2020-01-15 06:36:27
问题 On initial load, the annotations show just fine. But if I scroll the map, they all disappear and the code is only called for the user location, not the other annotations in the viewForAnnotation delegate method. Plot Pins -(void)viewDidLoad{ ...Download Coordinates and Data from Web here... [self.mapView addAnnotation:pin]; } Delegate Method - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { //Player's Pin if([annotation class] ==

How to refresh an MKOverlayRenderer when mapView change

為{幸葍}努か 提交于 2020-01-15 05:36:06
问题 I am new to code, and i'm trying to realize something like Reminders app : I've follow another answer to realize it and here my code: In my ViewController: var circle = MKCircle(centerCoordinate: location.coordinate, radius: 100) self.mapView.addOverlay(circle) In my MKMapView: func mapView(mapView: MKMapView!, rendererForOverlay overlay: MKOverlay!) -> MKOverlayRenderer! { if overlay is MKCircle { render = MapFillRenderer(overlay: overlay) return render } else { return nil } } And the

Using MapKit in SceneKit

徘徊边缘 提交于 2020-01-15 03:56:14
问题 This must be a very basic question to the pros out there. I have done quiet a bit of googling and cant find the answer I wanted. Is it possible to use MapKit in SceneKit to render animated characters on the map ? If it is not possible how is it done when it comes to Open World type games. I basically want to make a game that has the world map as background which can be zoomed in/out. Also need to show some game options based on user's location. All the examples I have seen is using a

Is it possible to use “Styled Maps” with MKMapView?

こ雲淡風輕ζ 提交于 2020-01-15 01:18:27
问题 Cheers, for about a year now Google allows you to adjust the styling of their maps according to your needs. They offer a tool which allows for the easy creation of styles too: Google Maps API Styled Maps Wizard What I'd like to know is: can this feature of their API be used with MKMapView as provided in the Map Kit Framework? If so, how and at which point would I feed the JSON code which the wizard produces to the API? If this doesn't work with MKMapView: What's the next best way to include

how can I limit the map area to only one country in iOS?

半腔热情 提交于 2020-01-14 14:39:07
问题 I am making an app for iOS using mapkit. I want to limit the boundaries of the map only to a specific region/country. Is there a way to do this? 回答1: There's no way to tell the map not to scroll out of a certain area. The only way I could think to do it would be to stop the user from scrolling when you hit one of your fences. The example below is written without testing or compiling at all so you may need to tweek it yourself but hopefully it'll get you started.. ViewController.h

How to get iPhone Maps app blue dot with light blue field for current location?

空扰寡人 提交于 2020-01-14 09:45:09
问题 I think the title is quite self explanatory. Currently when I add a default annotation for current location: let currentAnnot = MKPointAnnotation() currentAnnot.coordinate = loc.coordinate mainMap.addAnnotation(currentAnnot) It is giving me a red pin. I want the same blue dot with light blue field which the Apple iPhone Maps app is using by default. Is there a special name for that and how can I add it? 回答1: It's because you're adding an annotation (pin) rather than the user location. Enable

How to add a move back to user location button in swiftUI?

耗尽温柔 提交于 2020-01-14 03:27:28
问题 I am quite new to Swift and SwiftUI, and I want to add a user tracking button on top of the mapview, so user's current location can be back in the center of the screen when tapped. I have already have the mapview and the button, but failed to make it work. here is the ContentView.swift file, and I am stuck at the place with ****: import SwiftUI import MapKit struct ContentView: View { var body: some View { ZStack { MapView(locationManager: $locationManager) .edgesIgnoringSafeArea(.bottom)

How to make a custom MKAnnotationView with XIB

白昼怎懂夜的黑 提交于 2020-01-14 01:36:07
问题 I want to have a custom MKAnnotationView. I've created a xib file in IB and set its class to MyAnnotationView. class MyAnnotationView: MKAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } @IBOutlet weak var textLabel: UILabel! @IBOutlet weak var busIcon: UIImageView! } Here's how the xib looks

What is the difference between MKCoordinateSpan and CLLocationCoordinate2D

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-13 08:53:12
问题 I was going through the sample example of MapKit and CoreLocation framework. I found these two structs ( MKCoordinateSpan and CLLocationCoordinate2D ) which are similar in declaration. How are these different in functionality, can someone please site an example (using both) to clear their meanings. Thanks! 回答1: MKCoordinateSpan defines a span , i.e. a delta, in the latitude and longitude directions to show on a map. Along with a point you can then define a region to display on a map.

How to integrate new Google map app with ios app

只愿长相守 提交于 2020-01-12 20:28:10
问题 Google Map is now available in Appstore for IOS 6. I have a application which utilises MAPKIT and WebView to show Driving direction using Google webservices. For showing Route in Native Apple MAP app, i use codes similar to this.. MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place]; NSDictionary *options = @{ MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving }; [mapItem openInMapsWithLaunchOptions:options]; I want to show Route to the user in the New Google MaP