I want to go to specify line on my uiwebview loaded. I tried
[webView stringByEvaluatingJavaScriptFromString:@\"window.scrollTo(0.0, 100.0)\"];
Make sure you set the view controller where you have your web view to be a UIWebViewDelegate
, and declare this in the @interface
of the header file (.h).
[yourWebView setDelegate:self];
Then, in the webViewDidFinishLoad:
method, insert this code:
[yourWebView.scrollView scrollRectToVisible:CGRectMake(0, yourWebView.bounds.size.height + 100, 1, 1) animated:NO];
Try
webview.scrollView.contentOffset = CGPointMake(0, 100);