2016-07-30 16 views
0

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!

+0

versuchen Sie dies: mapView.topAnchor.constraintEqualToAnchor (view.topLayoutGuide) .active = true –

+1

"UIView hat kein Mitglied namens topLayoutGuide" :( – lucamegh

+0

mapView.topAnchor.constraintEqualToAnchor (topLayoutGuide.bottomAnchor) .active = true –

Antwort

0

extendedLayoutIncludesOpaqueBars = true auf dem View-Controller funktioniert.

Erweiterte Kanten unter oberen Balken im Attribute Inspector, wenn Storyboards verwendet werden.