开发者

UIWebView - Hide address bar when scrolling

开发者 https://www.devze.com 2023-01-30 06:46 出处:网络
I want to hide the address bar when I scroll in a UIWebView like in Safari so when the user scrolls down on the webpage, the menu bar gets pushed up so that the user can see the whole开发者_StackOverf

I want to hide the address bar when I scroll in a UIWebView like in Safari so when the user scrolls down on the webpage, the menu bar gets pushed up so that the user can see the whole开发者_StackOverflow中文版 page like in Safari.

Anyone suggestions and/or tutorials?

Thanks in advance!


Late answare, but if somebody needs this.

You can detect the scroll very easy. UIWebView conforms with UIScrollViewDelegate.

[webView.scrollView setDelegate:self];

and add method:

- (void) scrollViewDidScroll:(UIScrollView *)scrollView {
      if(scrollView.contentOffset.y == 0) {
          //show
      } else {
          //hide
      }
}


Nothing stops you putting a UINavigationBar inside a UIScrollView with the UIWebView. Maybe that's over complicating it - but it will give the effect you are looking for.


You can use this tutorial to detect scrolling. Then you can hide your address bar (I don't believe UIWebView includes one) when you detect the user scrolling.

0

精彩评论

暂无评论...
验证码 换一张
取 消