Skip to content
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

When UITableView is scrolled, the section header gets left behind #3

Open
timominous opened this issue May 22, 2013 · 22 comments
Open
Labels

Comments

@timominous
Copy link

Scrolling the tableview up leaves the section header at the bottom of the frame of the header and doesn't scroll along with the tableview. Is this fixable?

@Amnell
Copy link
Owner

Amnell commented May 22, 2013

Good find. This seems to be due to the tableView's contentInset not being changed while scrolling down.

I don't have a fix for this at this point.

@timominous
Copy link
Author

I think I have a possible fix for this.

#5

@forsan
Copy link

forsan commented Jun 12, 2013

hello guys...

thank you for amazing work.. but any new about this problem??

@helguita
Copy link

helguita commented Nov 8, 2013

Hello guys, is there any update on this issue?

@kimar
Copy link

kimar commented Mar 18, 2014

+1

@Amnell
Copy link
Owner

Amnell commented Jul 16, 2014

I've revisited this bug and sat down for a good couple of hours but I can't seem to find a good solution. It's a known bug without a clear workaround. Every "fix" creates another bug.

I've found a couple of blog posts and stack overflow posts that tries to fix this in other projects.
One is This blog post where a subclass of a uitableview repositions each table header view. May work for APParallaxHeader, but i don't think it's something that could be automatically integrated into the project. Someone please correct me if I'm wrong

The other fix is fixing the contentInset. I've already tried this for APParallaxHeader, and it breaks the scroll inertia and makes the parallax feel sluggish and buggy.

@cerupcat
Copy link

Has anyone made any progress on this?

@MobileMon
Copy link

It doesn't help when you guys leave +1 comment. It just annoys everyone who's watching the thread

@lukeirvin
Copy link

Has anyone solved this or is there an ETA?

@brucedaniel
Copy link

MobileMon: almost as annoying as the bug

@UBBproject
Copy link

Hi!
I solved this problem 1 year ago. Sorry, that I forgot to upload the code. Here it is.

#pragma mark - UITableView HackFix

  • (void)fixTableView
    {
    [self.theTableView setContentInset:UIEdgeInsetsMake(0, self.theTableView.contentInset.left, self.theTableView.contentInset.bottom, self.theTableView.contentInset.right)];

    if (self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
    {
    [self.theTableView setFrame:CGRectMake(0, 20, [HelperFunctionForFloat screenShorterSizeValue],[HelperFunctionForFloat screenLongerSizeValue]-20)];
    }

    if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {
    [self.theTableView setFrame:CGRectMake(0, 20, [HelperFunctionForFloat screenLongerSizeValue], [HelperFunctionForFloat screenShorterSizeValue]-20)];
    }

}

@lukeirvin
Copy link

Mind sharing these as well? [HelperFunctionForFloat screenShorterSizeValue],[HelperFunctionForFloat screenLongerSizeValue]

@UBBproject
Copy link

Ok.

@implementation HelperFunctionForFloat

  • (float)screenShorterSizeValue
    {
    float x;

    if ([[UIScreen mainScreen] bounds].size.width > [[UIScreen mainScreen] bounds].size.height)
    x = [[UIScreen mainScreen] bounds].size.height;
    else x = [[UIScreen mainScreen] bounds].size.width;

    // NSLog(@"shorter %f",x);

    return x;

}

  • (float)screenLongerSizeValue
    {
    float y;

    if ([[UIScreen mainScreen] bounds].size.width > [[UIScreen mainScreen] bounds].size.height)
    y = [[UIScreen mainScreen] bounds].size.width;
    else y = [[UIScreen mainScreen] bounds].size.height;

    // NSLog(@"longer %f",y);

    return y;

}

@EnD

@lukeirvin
Copy link

Still not scrolling for me

@akshaypakanati
Copy link

@robertofrontado it is working but there is a missing of smoothness in scrolling.
@Amnell is there any update on this bug..

is there anyone who fixed this bug??

@Ronaldoh1
Copy link

Is there an update for this bug? I'm also experiencing the same problem.

@RishabhTayal
Copy link

Have you tried setting the tableView type as grouped? I haven't tried it myself though.

@Ronaldoh1
Copy link

i need the header to stick to the top of the tableview

@RishabhTayal
Copy link

@Ronaldoh1 I believe that should fix the issue. Can you please try that?

@Amnell
Copy link
Owner

Amnell commented Jan 8, 2016

@RishabhTayal Grouped wont give you a sticky header thou, and thats the main issue with this bug.

I have not been able to find a solution for this bug, and I'm very certain that it is not possible to solve it and maintain a natural deceleration/inertia.

@Ronaldoh1
Copy link

the sticky header doesn't stay with group style
:(

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

No branches or pull requests