Scrolling with multiple TableViews
I am facing a problem with changing the ScrollView of my PanelController. I have added a UIPageViewController to my PanelController which shows one TableView on each page and should be the scrollview being tracked when presented. The viewcontroller which presents the panel is being notified about changes by the PageViewController.
This is looking like the following:
func timetableViewController(_ timetableViewController: TimetableViewController, didChange index: Int, with viewController: TimetableItemViewController) {
viewController.tableView.delegate = viewController
panel.track(scrollView: viewController.tableView)
}
I have debugged this and found that scrollViewDelegate of FloatingPanel is actually overwritten but does not respond to scrolls except to the first TableView being initialised.
Please let me know if I should provide you with a Demo Project.
Thanks in advance!
I'm sorry to be late for my reply. Could you please provide me with a Demo project?
Tracking this as well.
I am trying to achieve the same thing as David, do you still need a demo project to investigate it further? Happy to provide one.
@lazlox Yes, I do! That's so helpful for me. Because FloatingPanelController hasn't intercepted UIScrollViewDelegate since v1.4.1 actually. So I would like to know the latest version still happens and understand this issue.
Actually made it work with the demo I was putting together.
Here is what I did (apologies for the code, I am a rather naive and absolutely beginner developer):
This is the embed segue to embed pageviewcontroller into a containerview inside my panel VC:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let pageViewController = segue.destination as? PageViewController {
pageViewController.parentPanelController = self.parent as? FloatingPanelController
}
}
PageViewContoller has a variable that gets set by the embed segue above:
var parentPanelController: FloatingPanelController? = nil
PageViewController delegate method:
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
if let page1View = pageViewController.viewControllers?.first as? Page1ViewController {
self.parentPanelController?.track(scrollView: page1View.tableViewPage1)
} else {
let page2View = pages[1] as! Page2ViewController
self.parentPanelController?.track(scrollView: page2View.tableViewPage2)
}
}
This is exactly what I needed in my app, not sure if others are looking for any extra functionality around this but hope the above helps!
Thanks for your description! I understood this issue and then I created fix-scroll-tracking-switch branch to attempt to fix this. Would you please try it?
Edit:
I added "Show Page Content" samples in the Samples app. But I can't find any problem even before a patch is applied. So now I don't know your issue.