telly / TLYShyNavBar

Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars!
MIT License
3.73k stars 427 forks source link

UIScrollView contentInset not working when using TLYShyNavBar with UIWebView #139

Closed chika-kasymov closed 8 years ago

chika-kasymov commented 8 years ago

I add header to UIWebView as subview and constraints to make the trick, so that header not overlays UIWebView content.

Sample code:

[self.webView.scrollView addSubview:self.newsPagerView];
[self.newsPagerView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-headerHeight;
[self.newsPagerView autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:self.webView];
[self.newsPagerView autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:self.webView];

self.webView.scrollView.contentInset = UIEdgeInsetsMake(headerHeight, 0, 0, 0);

Code works great, but when I added TLYShyNavBar self.shyNavBarManager.scrollView = self.webView.scrollView;, UIWebView's UIScrollView's contentInset not works. contentInset has right value, but visually placed wrong.

chika-kasymov commented 8 years ago

I will use another approach to implement header.