mapkit

pass array of map coordinates to a draw a route on map in swift

大兔子大兔子 提交于 2021-02-11 12:41:44
问题 hi I have an array of coordinates data like this, which is retrieved from an API call, and I use a for loop to append the data into an array like this: extension TripListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { performSegue(withIdentifier: Constants.segueTripListToTripMap, sender: indexPath) tableView.deselectRow(at: indexPath, animated: true) } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if

pass array of map coordinates to a draw a route on map in swift

爷,独闯天下 提交于 2021-02-11 12:41:20
问题 hi I have an array of coordinates data like this, which is retrieved from an API call, and I use a for loop to append the data into an array like this: extension TripListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { performSegue(withIdentifier: Constants.segueTripListToTripMap, sender: indexPath) tableView.deselectRow(at: indexPath, animated: true) } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if

Set MapKit pins with different colors

六眼飞鱼酱① 提交于 2021-02-11 12:38:06
问题 I am new in iOS and I implemented a MapKit with static markers from different arrays types and they are working fine , I am trying to put pins that come from shops array to be blue for example , and pins that come from community read , etc .. I have no idea about how to do this at all , they are all in red in the map and my goal is to change the color for every array of pins here what I have tried : import UIKit import MapKit class myMapViewController: UIViewController, MKMapViewDelegate {

Alert view disappears on its own when calling [locationManager requestWhenInUseAuthorization];

让人想犯罪 __ 提交于 2021-02-06 14:22:02
问题 I'm calling [locationManager requestWhenInUseAuthorization]; on a screen that shows an MKMapView ( showsUserLocation = YES ). Which seems weird in the first place (Apple should handle this for MKMapView automatically, but XCode was complaining when I didn't do it). So I get the alert view that says the application wants to use your location, but then the alert view disappears on its own. Why does the alert view disappear on its own? Only thing I can think of is that I am calling

How to work with new iOS Google Maps SDK under no ARC project

限于喜欢 提交于 2021-02-04 21:48:15
问题 I'm trying to add the new Google Maps API into my iOS application, however it does not use ARC yet. So, checking at the docs I think it's a requirement to have ARC in order for the SDK to work. How could I do that? I mean an option would be activating ARC just for the resources that will work with Google maps. (.xib files, controllers) How could that be done? 回答1: you can disable ARC for individual files by adding a compiler flag -fno-objc-arc This flag tells the compiler that the files are

How to implement iOS 11's MKUserTrackingButton

╄→гoц情女王★ 提交于 2021-02-04 04:56:56
问题 I'm trying to implement a MKUserTrackingButton (which is new in iOS 11 SDK). This "button" actually inherits from UIView so I just put a UIView instance on my Map and in the Identity Inspector, linked it to the MKUserTrackingButton class, added an outlet in my code and in viewDidLoad(). I initialize it the following way: self.centerMapButton = MKUserTrackingButton.init(mapView: self.mapView) However, nothing works, I just have a blank view on my Map. PS: Here's the WWDC 2017 session about

reload map after calling urlsession data

匆匆过客 提交于 2021-01-29 15:36:16
问题 I am new in swift , I implemented a MapKit with static data , and it worked fine , and I called after that backend pins data and it showed in the playground that it works fine , but the map is not displaying the markers , it seems that the mapKit do not capture the pins data in the right time , so I used Dispatch.Que to refresh the map but I did not refresh and it is displaying without the markers here what I have tried : import UIKit import MapKit class myMapViewController: UIViewController,

How to set a custom annotations for all points except for user location?

≯℡__Kan透↙ 提交于 2021-01-29 14:30:53
问题 After the authorization checks, to obtain the user location, I am calling this CLLocation delegate function: func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let latestLocation = locations.first else { return } if currentCoordinate == nil { zoomToLocation(with: latestLocation.coordinate) } currentCoordinate = latestLocation.coordinate } And then I zoom onto the user's location: func zoomToLocation(with coordinate: CLLocationCoordinate2D) {

Create a clickable map preview using MKMapSnapshotter

我与影子孤独终老i 提交于 2021-01-29 04:56:06
问题 I have a map that currently shows the user's current location with no pin to show them exactly where they are. I want to make the map a photo of where the user's set location is. I only know how to show where their device is and need them to be able to set their base of operations. I don't need specific addresses. I just need the city where they reside. I then need the image to be able to be tapped on. When tapped, the image makes the MapKit full screen and interactive. They can then zoom

Create a clickable map preview using MKMapSnapshotter

二次信任 提交于 2021-01-29 04:52:02
问题 I have a map that currently shows the user's current location with no pin to show them exactly where they are. I want to make the map a photo of where the user's set location is. I only know how to show where their device is and need them to be able to set their base of operations. I don't need specific addresses. I just need the city where they reside. I then need the image to be able to be tapped on. When tapped, the image makes the MapKit full screen and interactive. They can then zoom