I have tried everything to make my view appear over the map view (see code below), but it still won't show up. I don't know what to do. This is the mapView at 0.5 alpha
segmentedControl = DPSegmentedControl.init(
FrameWithoutIcon: CGRectMake(307.5, 566, 235, 37.5),
items: ["Standard", "Satellite", "Hybrid"],
backgroundColor: UIColor(red: 230/255, green: 230/255, blue: 230/255, alpha: 1),
thumbColor: UIColor.init(hex: "#B60002"),
textColor: UIColor(hex: "#808080"),
selectedTextColor: UIColor(hex: "#FFFFFF"))
segmentedControl.alpha = 0
segmentedControl.selectedIndex = 0
segmentedControl.addTarget(self, action: #selector(self.tapSegment(_:)), forControlEvents: .ValueChanged)
self.view.insertSubview(self.segmentedControl, belowSubview: self.hoverBar)
UIApplication.sharedApplication().keyWindow!.bringSubviewToFront(self.segmentedControl)
UIApplication.sharedApplication().keyWindow!.sendSubviewToBack(self.mapView)
When I use z position, the view appears, but it does not allow any touch actions (it is a custom segmented control).
self.segmentedControl.layer.zPosition = self.mapView.layer.zPosition + 1
Have your tried either of these?
self.view.bringSubviewToFront(self.segmentedControl)
self.view.sendSubviewToBack(self.mapView)
or
self.segmentedControl?.superview.bringSubviewToFront(self.segmentedControl)
self.mapView?.superview.sendSubviewToBack(self.mapView)