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

Have a navigation bar, refresh will make the first message is hidden under the navigation bar #235

Open
andi911 opened this issue Jan 20, 2015 · 6 comments

Comments

@andi911
Copy link

andi911 commented Jan 20, 2015

No description provided.

@liruqi
Copy link

liruqi commented Jan 20, 2015

I got the same problem recently. You need to add action handler in - viewDidAppear method or after, as you can get correct scroll view contentInset then (after iOS7).

- addPullToRefreshWithActionHandler method record current scrollview contentInset as originalTopInset, originalBottomInset and reset to that contentInset after - stopAnimating.

@sinabs
Copy link

sinabs commented Apr 29, 2015

(void)viewDidLoad {
     UIEdgeInsets inset = UIEdgeInsetsMake(64, 0, 0, 0); //64 is navigation.height+20
     self.tableView.contentInset = inset;
     self.tableView.scrollIndicatorInsets = inset;
}

@cohix
Copy link

cohix commented May 25, 2015

The workaround from @sinabs makes the position of the tableView correct AFTER the pullToRefresh is triggered, but the placement beforehand is still incorrect.

@sinabs
Copy link

sinabs commented May 26, 2015

try a again this.

(void)viewDidLoad {
     //UIEdgeInsets inset = UIEdgeInsetsMake(64, 0, 0, 0); //64 is navigation.height+20
     //self.tableView.contentInset = inset;
     //self.tableView.scrollIndicatorInsets = inset;
     [self.navigationController.navigationBar setTranslucent:NO];
}

@neil-wu
Copy link

neil-wu commented Jul 1, 2015

as liruqi said, I put action handler in - viewDidAppear, and it works fine~

@litt1e-p
Copy link

this is my solution: in viewDidLoad add below codes and it woks fine

if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
        self.automaticallyAdjustsScrollViewInsets = NO;
        UIEdgeInsets insets                       = self.tableView.contentInset;
        insets.top                                = self.navigationController.navigationBar.bottom;
        self.tableView.contentInset               = insets;
        self.tableView.scrollIndicatorInsets      = insets;
    }

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

No branches or pull requests

6 participants