1
votes

I'd like to display a toolbar above a UIWebView but hide the toolbar until the person "pulls it down".

The same functionality can be seen in Safari on the iPhone. When the page loads, the toolbar containing the address is hidden. You must pull it down. In Safari it's possible to scroll up and eventually see the toolbar or scroll down through the page contents.

I've tried placing a UIToolbar and UIWebView inside a UIScrollView but it didn't work. I've tried setting the UIScrollView to the size of the toolbar and webview combined, but that didn't work.

- (void)viewDidLoad{
    CGSize size = CGSizeMake(webView.frame.size.width,
                              toolBar.frame.size.height + webView.frame.size.height);
    [scrollView setContentSize:size];
}

How should I go about doing this?

EDIT

Anyone looking at this should consider that the question and accepted answer are both old and that the API might have changed to allow this.

1

1 Answers

0
votes

The UIWebView is itself a UIScrollView so it's not going to work. I'm not sure how Apple does it, but one way to do it, if you have control over the content of the web view, is to write some HTML and CSS that replicates that address bar.