I have a simple app where I run some GET queries and fire off a modal view once they complete. The presenting view controller contains a map view with a search controller/search bar. As the modal is triggered, it presents overCurrentContext (with blur effects) as expected however the navigation bar (with cancel button) slides underneath the search bar. I can see the navigation bar is created properly (with title and cancel button) but it transitions underneath the search bar. Have I done something incorrectly?
Presenting viewController
func showPopOver() {
let fares = Fares(userLocation: userLocation, destination: userDestination)
fares.getFares { _ in
self.RideCosts = self.storyboard!.instantiateViewController(withIdentifier: "RideCosts") as! RideCosts
self.RideCosts.modalPresentationStyle = .overCurrentContext
self.RideCosts.loadFares(fares: fares.fareArray)
self.present(self.RideCosts, animated: true, completion: nil)
}
}
modalViewController (RideCosts)
class RideCosts: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
@IBAction func cancel(_ sender: UIBarButtonItem) {
dismiss(animated: true, completion: nil)
}
var fareArray: [(name: String, value: String)] = []
var arrayOfCellData = [cellData]()
override func viewDidLoad() {
super.viewDidLoad()
let blurEffect = UIBlurEffect(style: .extraLight)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.view.frame
self.view.insertSubview(blurEffectView, at: 0)
self.view.backgroundColor = UIColor.clear
self.modalTransitionStyle = .crossDissolve
self.isModalInPopover = true
tableView.delegate = self
tableView.dataSource = self
}