mercredi 29 juin 2016

GMSMapView does not occupy full bounds

I've designed the following layout on XCode:

enter image description here

The button Layout (Cancel, Sign Up) is pinned to the bottom layout guide. On top of that are 3 equally sized UIViews, each with 1px vertical spacing in between them.

The remaining space is occupied by mapView, which is a UIView. It is pinned to the top, leading and trailing layout guide. It also has 8px spacing between the building number view.

When I run the application on my iPhone 6, I get this:

enter image description here

The map is not drawn in all available space. I don't know why:

When setting up the map, I do pass the bounds of the mapView:

class RegisterAddressViewController: BaseViewController, CLLocationManagerDelegate, GMSMapViewDelegate {

    @IBOutlet var mapView : UIView!

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.setupMapView()
        self.setupLocationManager()
    }

    func setupMapView(){
        let camera = GMSCameraPosition.cameraWithLatitude(-33.86,
                                                          longitude: 151.20, zoom: 6)
        self.gmsMapView = GMSMapView.mapWithFrame(self.mapView.bounds, camera: camera)
        self.gmsMapView!.delegate = self
        self.mapView.addSubview(self.gmsMapView!)
    }

    //...
}

I do not believe it's an AutoLayout issue since no warning appears in the console and the light grey background of the mapView indicates that the layout is set correctly.

Is there some configuration that I'm missing? Thanks.

Aucun commentaire:

Enregistrer un commentaire