mkmapview

Mapview shows White overlay on Interaction

吃可爱长大的小学妹 提交于 2021-02-10 05:46:09
问题 I am using GMSMapView with SwiftUI, in map-view I have to display some markers with lat and long. Upon clicking any marker I have to Move to another view. I am doing this by putting MapView in NavigationLink . This thing is working fine By using code. NavigationView { NavigationLink(destination: Text(""), isActive: $abc) { MapView().edgesIgnoringSafeArea(.all) } } And the issue is NavigationLink , after putting mapview in NavigationLink every-time when i interact with map, white overlay

MKMapView struggles with zero height constraint - edgeInsets of map view?

独自空忆成欢 提交于 2021-02-09 18:13:12
问题 I have an MKMapView about 300 high which collapses between two other views, simply animating the height up and down as you'd usually do when collapsing a view. @IBOutlet var heightMap: NSLayoutConstraint! @IBOutlet var theMap: MKMapView! When the view launches it is height zero.. override func viewDidLoad() { super.viewDidLoad() .. heightMap.constant = 0 } there's an infuriating warning... [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the

MKMapView struggles with zero height constraint - edgeInsets of map view?

五迷三道 提交于 2021-02-09 17:59:06
问题 I have an MKMapView about 300 high which collapses between two other views, simply animating the height up and down as you'd usually do when collapsing a view. @IBOutlet var heightMap: NSLayoutConstraint! @IBOutlet var theMap: MKMapView! When the view launches it is height zero.. override func viewDidLoad() { super.viewDidLoad() .. heightMap.constant = 0 } there's an infuriating warning... [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the

MKMapView struggles with zero height constraint - edgeInsets of map view?

人走茶凉 提交于 2021-02-09 17:58:49
问题 I have an MKMapView about 300 high which collapses between two other views, simply animating the height up and down as you'd usually do when collapsing a view. @IBOutlet var heightMap: NSLayoutConstraint! @IBOutlet var theMap: MKMapView! When the view launches it is height zero.. override func viewDidLoad() { super.viewDidLoad() .. heightMap.constant = 0 } there's an infuriating warning... [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the

Force MKMapView viewForAnnotation to update

断了今生、忘了曾经 提交于 2021-02-06 15:18:33
问题 So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation is called and the colours are set accordingly. However, when I update the pin's details (such as location, title, etc...) I also update the pinColour to find it doesn't update. It looks like viewForAnnotation isn't called again after the initial add. I have read many questions similar to this and I can confirm that mapView

Force MKMapView viewForAnnotation to update

安稳与你 提交于 2021-02-06 15:17:59
问题 So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation is called and the colours are set accordingly. However, when I update the pin's details (such as location, title, etc...) I also update the pinColour to find it doesn't update. It looks like viewForAnnotation isn't called again after the initial add. I have read many questions similar to this and I can confirm that mapView

Tapping an MKMapView in SwiftUI

耗尽温柔 提交于 2021-01-29 19:43:14
问题 I have a map in a SwiftUI app. It is working up to a point; but now I want to be able to tap on it and know the latitude and longitude of the tap. Here is the current code: import SwiftUI import MapKit struct MapView: UIViewRepresentable { @Binding var centerCoordinate: CLLocationCoordinate2D func makeUIView(context: Context) -> MKMapView { let mapView = MKMapView() mapView.delegate = context.coordinator let gRecognizer = UITapGestureRecognizer(target: context.coordinator, action: #selector

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) {

How can I add a MapView to another View in Swift?

99封情书 提交于 2021-01-29 14:01:29
问题 I have 2 tabs in my application. On the first one, I display a View (which is myView, a self defined struct) and on the second one I want to display a MapView. I found several tutorials, showing how to add a MapView via Storyboard, but I don't get how I can finally display it in one of my Tabs. The tabs are created as follows: struct ContentView: View { @State private var selection = 0 var body: some View { TabView(selection: $selection){ myView() .font(.title) .tabItem { VStack { Image

SwiftUI Button on top of a MKMapView does not get triggered

雨燕双飞 提交于 2021-01-05 11:32:43
问题 I have a button on top of a MKMapView. But the button does not get triggered when it's tapped on. Do you know what's missing? MapView.swift import SwiftUI import UIKit import MapKit struct MapView: UIViewRepresentable { func makeUIView(context: Context) -> MKMapView { let mkMapView = MKMapView() return mkMapView } func updateUIView(_ uiView: MKMapView, context: Context) { } func makeCoordinator() -> Coordinator { Coordinator() } class Coordinator: NSObject, MKMapViewDelegate { } } ContentView