Ich habe eine MKMapView
als Unteransicht zum view
eines View - Controllers (eingebettet in eine Navigationssteuerung) hinzugefügt. Dann habe ich Anker verwendet, um es an den Seiten meines sehen wie folgt:Ansicht (MKMapView) ändert sich, wenn die Navigationsleiste ausgeblendet wird
mapView.leadingAnchor.constraintEqualToAnchor(view.leadingAnchor).active = true
mapView.trailingAnchor.constraintEqualToAnchor(view.trailingAnchor).active = true
mapView.topAnchor.constraintEqualToAnchor(view.topAnchor).active = true
mapView.bottomAnchor.constraintEqualToAnchor(view.bottomAnchor).active = true
als ich navigationController?.setNavigationBarHidden(true, animated: true)
verwenden, um meine Navigationsleiste auszublenden, wird die mapView
größer, als ob es nicht an der Spitze meiner view
verankert war, aber am Ende meiner Navigationsleiste wie kann ich. vermeiden Sie das? Ich möchte, dass die Navigationsleiste aus dem Bildschirm herausrutscht und eine Vollbild-Karte mit der gleichen Position/Höhe zurücklässt
Vielen Dank!
versuchen Sie dies: mapView.topAnchor.constraintEqualToAnchor (view.topLayoutGuide) .active = true –
"UIView hat kein Mitglied namens topLayoutGuide" :( – lucamegh
mapView.topAnchor.constraintEqualToAnchor (topLayoutGuide.bottomAnchor) .active = true –