Is there a way of changing the scroll position of a UIWebView based on the current URL?
For example:
if (webView = thisURL) {
webView scrollPosition = ...
}
elseif (webView = thisURL) {
webView scrollPosition = ...
}
Thanks
Is there a way of changing the scroll position of a UIWebView based on the current URL?
For example:
if (webView = thisURL) {
webView scrollPosition = ...
}
elseif (webView = thisURL) {
webView scrollPosition = ...
}
Thanks
Implement the UIWebViewDelegate, then make something like this:
-(void) webViewDidFinishLoad:(UIWebView *)webView{
NSString *currentURL = webView.request.URL.absoluteString;
if([currentURL isEqualToString:@"http://www.foo.com/uri"])
[webView stringByEvaluatingJavaScriptFromString:@"scrollTo(100,100);"];
}
It catches the curren url displayed in the Web View, then it compares to another url and if the comparison returns true, the current webview fires a javascript calling the scrollTo() function.