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 UIWebView
s 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.
I found my solution here- leaving the question open as it may be useful to others.
How to increase the page height by X pixels by using only javascript
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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.