当子视图显示在滚动视图上方时,它不会滚动
When a subview is displayed above the scroll view, it does not scroll
当子视图显示在滚动视图上方时,它不会滚动。
我的子视图是这样显示的:
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)
然后出现一个子视图(reservationPopOverVC.view
),但是在它下面滚动的主视图不起作用。我该如何解决?
您应该简单地禁用视图的用户交互:
reservationPopOverVC.view.isUserInteractionEnabled = false
当子视图显示在滚动视图上方时,它不会滚动。
我的子视图是这样显示的:
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)
然后出现一个子视图(reservationPopOverVC.view
),但是在它下面滚动的主视图不起作用。我该如何解决?
您应该简单地禁用视图的用户交互:
reservationPopOverVC.view.isUserInteractionEnabled = false