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.
精彩评论