Tarvo Mäesepp Tarvo Mäesepp - 1 month ago 10
iOS Question

Disable scrolling in tableview while popup is opened

I created simple poUp in swift however I can't seem to find answer to "how to disable scrolling in

tableview
while popup is opened?". The problem is that if popUp is opened I do not want to scroll.

That is how I create the popUp inside
tableview
if button is tapped:

let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "RatingViewController") as! RatingViewController
self.addChildViewController(popOverVC)
popOverVC.view.frame = self.view.frame
self.view.addSubview(popOverVC.view)
popOverVC.didMove(toParentViewController: self)
tableView.alwaysBounceVertical = false


I want it to be full screen and scrolling disabled but right now it is under navigationBar and scrolling is enabled.

I tried adding this line
tableView.alwaysBounceVertical = false
but it does nothing.

To illustrate things:

enter image description here

Answer

UITableViewinherits from UIScrollView. You can controll scrolling by setting isScrollEnabled.