Quote:
Originally Posted by ArtandIllustration
Hi All,
I've got a series of WebViews linked to URLs and currently using scrollbars but I was wondering if its actually possible to declare a UIWebView to load up at a certain part of a web page, for example, when it loads up, it shows the bottom right corner or middle right or something instead of top left?
Thanks 
|
This is an example for bottom right (for middle right just /2 offsetWidth)
set your uiwebview delegate to self, and add
Code:
-(void)webViewDidFinishLoad:(UIWebView *)webView {
NSInteger offsetHeight= [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] intValue];
NSInteger offsetWidth= [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetWidth;"] intValue];
NSString* js = [NSString stringWithFormat:@"window.scrollBy(%d, %d);",offsetWidth, offsetHeight];
[webView stringByEvaluatingJavaScriptFromString:js];
}