Google Maps GMSMapView on custom UIView

后端 未结 8 1642
陌清茗
陌清茗 2020-12-14 20:33

I want to display google maps on a view that\'s then added to self.view, rather than drawing the map directly on self.view. Therefore, I created a

相关标签:
8条回答
  • 2020-12-14 21:15

    You can position a blank UIView in your layout, and set its class in the inspector as a GMSMapView. You won't need to programmatically instantiate it.

    Then just get a reference via outlet to the view and set your coordinates/camera.

    0 讨论(0)
  • 2020-12-14 21:15

    We can use zPosition in iOS.

    If we have a view named salonDetailView, eg:

    @IBOutlet weak var salonDetailView: UIView!
    

    in my case see the image

    and have UIView for GMSMapView, eg:

    @IBOutlet weak var mapViewUI: GMSMapView!
    

    To show salonDetailView upper of the mapViewUI use zPosition as below:

    salonDetailView.layer.zPosition = 1
    
    0 讨论(0)
提交回复
热议问题