SVPullToRefresh icon indicating copy to clipboard operation
SVPullToRefresh copied to clipboard

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

Open andi911 opened this issue 10 years ago • 6 comments

andi911 avatar Jan 20 '15 03:01 andi911

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.

liruqi avatar Jan 20 '15 08:01 liruqi

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

sinabs avatar Apr 29 '15 09:04 sinabs

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

cohix avatar May 25 '15 22:05 cohix

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];
}

sinabs avatar May 26 '15 15:05 sinabs

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

neil-wu avatar Jul 01 '15 07:07 neil-wu

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;
    }

litt1e-p avatar Nov 19 '15 06:11 litt1e-p