views:

234

answers:

2

Hi folks,

I have a translucent toolbar over the bottom of my UIWebView. The trouble is, if there is a link at the bottom of the page, I can't press it because the webview will always bounce back down to the bottom.

I don't want to shrink the webview and use a solid colour toolbar, and UIWebViews interface doesn't open much up.

What I would like to do, ideally, is to actually increase the size of the web page by one toolbar height, so that I can scroll that extra bit and have all the content above the toolbar, but when scrolling down I will be able to see the page content through the toolbar. I could use the stringByEvaluatingJavaScriptFromString: function of UIWebView.

I'm very rusty on JavaScript- is it possible for me to do this? Increase the window height or something?

I tried:

 [webView stringByEvaluatingJavaScriptFromString: [NSString  stringWithFormat:@"window.resizeBy(0,%d);", TOOLBAR_HEIGHT] ];

but it didn't do anything.

Any pointers welcome. Thanks.

A: 

I found my solution here- leaving the question open as it may be useful to others.

http://stackoverflow.com/questions/799743/how-to-increase-the-page-height-by-x-pixels-by-using-only-javascript

Sam
A: 

If you're using the UIWebView to display HTML, I would argue that it's cleaner to fix this with CSS:

body {
  padding-bottom: 50px;
}
thomax