-
-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scroll to top doesn't work correctly #389
Comments
Didn't help me! |
Hi @arashetm @IBAction func segmentChange() {
if let navigationController = self.navigationController as? ScrollingNavigationController {
navigationController.showNavbar(animated: true, duration: 0.2, scrollToTop: true)
}
} and it seems to be working fine. Can you share a sample project showing the issue? |
I figured out what's the problem! @IBAction func segmentValueChanged(_ sender: UISegmentedControl) {
_ = self.scrollViewShouldScrollToTop(self.archiveTableView)
self.setBannersFrame() //setting table header view
// change table view's data based on the selected segment
self.reloadArchiveTableView() // reloading table view
} I found a hacky slution for this:: @IBAction func segmentValueChanged(_ sender: UISegmentedControl) {
_ = self.scrollViewShouldScrollToTop(self.archiveTableView)
self.setBannersFrame() //setting table header view
// change table view's data based on the selected segment
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.reloadArchiveTableView() // reloading table view
}
} Maybe you need to add completion handler for |
Sounds good, checkout the latest master commit for the completion handler in |
It didn't work ... |
I'm afraid it's still triggered too early, before UIKit rearranges the table |
Do you have any suggestions? |
Checkout the updated demo in master, the tableview now scrolls to top and updates the data source, and it seems to be working. Maybe it helps, let me know |
Any feedback? |
you can fix it by calling collectionview's scrolltoItem method in the completion block:
|
Describe the bug
scroll to the top doesn't work correctly.
To Reproduce
create a tableView including too many items.
scroll to the middle of tableView and then call this:
It scrolls to top but not actually to top of tableView.
The text was updated successfully, but these errors were encountered: