Centell
Centell

Reputation: 409

When a subview is displayed above the scroll view, it does not scroll

When a subview is displayed above the scroll view, it does not scroll.

My subview is displayed in the following way:

let reservationPopOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "reservationPopup") as! ReservationPopupViewController
        self.addChildViewController(reservationPopOverVC)
        reservationPopOverVC.view.frame = self.view.frame
        self.view.addSubview(reservationPopOverVC.view)
        reservationPopOverVC.didMove(toParentViewController: self)

Then a subview (reservationPopOverVC.view) appears, but the main view'a scrolling below it does not work. How can I solve this?

Upvotes: 0

Views: 551

Answers (1)

glyvox
glyvox

Reputation: 58149

You should simply disable the user interaction for the view:

reservationPopOverVC.view.isUserInteractionEnabled = false

Upvotes: 1

Related Questions