iOS - How to add UI elements on top of AGSMapView

270
1
09-17-2019 08:24 PM
SteveEllis1
New Contributor II

I'm using iOS 100.6 and am trying to place a UIbutton on top of AGSMapView. In the View Controller MapView and the UIButton are under "View". The UIbutton is not a subview of MapView. How do I get other UI element in my view to be visible on top of the map. I have three other elements that I hide and unhide using "isHidden = true/false" and these cannot be displayed either. Code in Swift 4.2.

Here is the view:

View Controller "View"

Here is the code snippet:

let viewMap = AGSMapView(frame: .zero)

viewMap.map = AGSMap(basemapType: .navigationVector,

                                         latitude: currentLocation.latitude, longitude: currentLocation.longitude,

                                         levelOfDetail: zoomLevel)

viewMap.graphicsOverlays.add(overlay)

viewMap.touchDelegate = self

view = viewMap

view.bringSubviewToFront(btnSatelliteToggle)

0 Kudos
1 Reply
SteveEllis1
New Contributor II

I actually just solved this. Here is the updated code that works:

viewMap.map = AGSMap(basemapType: .navigationVector,

                                         latitude: currentLocation.latitude, longitude: currentLocation.longitude,

                                         levelOfDetail: zoomLevel)

viewMap.graphicsOverlays.add(overlay)

viewMap.touchDelegate = self

I removed: 

let AGSMapView(frame: .zero)

as this prevented the map from being displayed in MapView.

Also, by not setting a view (thus using the default view controller "view") all siblings are available for display and can be controlled via "isHidden."

0 Kudos