Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

fix false origin y of emptyDataSet view when scrollview had been scrolled #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benrudhart
Copy link

after scrolling a tableView and re-showing the emptyDataSet the offset (within a tableView) won't be fixed but adjusted to the scrollView's Y contentOffset.
This PR fixes this.

@marcelmika
Copy link

Hi!

I'm having the same issue and this PR fixes it. So +1 for merge.

P.S.
However, if I use tableView.reloadSections (with animation) instead of the tableView.reloadData the placeholder animates from the top to center. It's not a big deal, since it only happens when the user scrolled down before, however, do you have any idea how to fix this too?

colinhumber added a commit to colinhumber/DZNEmptyDataSet that referenced this pull request Apr 27, 2016
@osorioabel
Copy link

Hi!
I'm having the same issue and this PR fixes it. Please do the merge

@dzenbot
Copy link
Owner

dzenbot commented May 27, 2016

@marcelmika: maybe we can add the view and adjust the frame inside of a performWithoutAnimation: method.

@allaire
Copy link

allaire commented May 31, 2016

@dzenbot Anything preventing this PR getting merge?

Just tested it and it fixed the issue for me.

Thanks for your time 🍺

@benrudhart
Copy link
Author

@dzenbot is there anything preventing this PR from being merged?

@dzenbot
Copy link
Owner

dzenbot commented Jun 5, 2016

@benrudhart: I was mostly concerned about #182 (comment)
But maybe we can tackle that in a different PR?

@allaire
Copy link

allaire commented Jun 29, 2016

@dzenbot Yes, since it's minor, we could tackle this in a different PR, absolutely.

Cheers!

@TunaYangSkey
Copy link

vote for merge +1.

For people who has the same issue, there is a way to walk around it by calling self.tableView.setContentOffset(CGPointZero, animated:false) before reload the tableView. This will scroll to the top of the tableView, hence prevent the EmptyDataSet being off the screen

@rinat-enikeev
Copy link

Other possible solution:
in Delegate:

  • (void)emptyDataSetWillAppear:(UIScrollView *)scrollView {
    [self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top)];
    }

@wy284086
Copy link

I'm having the same issue, please tell me how to do

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants