Amal El-galant
Amal El-galant

Reputation: 139

iOS Google Maps API - Views do not Overlay Over the Map in swift

I want to add another view below the Map but the view disappear at run time.

at run time typeView disappears because of googlemap

enter image description here

edit

at run time

enter image description here

type view

Upvotes: 1

Views: 1245

Answers (2)

Litle Dev
Litle Dev

Reputation: 493

Create storyboard connection the views,

@IBOutlet weak var mapView: GMSMapView!
@IBOutlet weak var typeView: UIView!

Now, you can solve the issue by two ways,

One way:

self.mapView.sendSubview(toBack: self.typeView)

The Second Way:

self.view.bringSubview(toFront: self.typeView)

Upvotes: 3

Saurabh Bhatia
Saurabh Bhatia

Reputation: 1925

From what you asked, I understand that you want Type view to be shown over the Google Map. If so, then

  1. Simply create an IBOutlet of the Type view as:

    @IBOutlet weak var typeView: UIView!
    
  2. Use the below code to bring the typeView on the front:

    self.bringSubview(toFront: self.typeView)
    

(I am assuming that this code is to go in View)

Upvotes: 2

Related Questions