当子视图显示在滚动视图上方时,它不会滚动

时间:2017-09-01 14:35:02

标签: ios swift uiscrollview addsubview

当子视图显示在滚动视图上方时,它不会滚动。

我的子视图以下列方式显示:

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),但主视图'在其下方滚动不起作用。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您应该只是禁用视图的用户交互:

reservationPopOverVC.view.isUserInteractionEnabled = false