У меня есть другой метод, который я нашел в http://www.alexnking.com/2008/10/14/going-back-to-the-last-place-you-were-in-a-uiwebview/,, который может быть очень полезен, если вы хотите прокрутить UIWebView вручную.
Чтобы получить текущую позицию прокрутки (по вертикали):
[myWebView stringByEvaluatingJavaScriptFromString: @"scrollY"];
// Application is terminating.
- (void)applicationWillTerminate:(UIApplication *)application {
[[NSUserDefaults standardUserDefaults] setInteger:
[[myWebView stringByEvaluatingJavaScriptFromString: @"scrollY"]
intValue] forKey: @"currentScroll"];
}
// Application is loading.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
initialScrollPosition = [[NSUserDefaults standardUserDefaults]
integerForKey: @"currentScroll"];
}
// WebView is finished loading
- (void)webViewDidFinishLoad:(UIWebView *)webView {
// Check if we need to scroll this somewhere.
if (initialScrollPosition != 0) {
// Scroll to the position.
[passageView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat: @"window.scrollTo(0, %d);",
self.initialScrollPosition]];
// Set the initial scroll value to zero so we don't try
// to scroll to it again if the user navigates to another page.
self.initialScrollPosition = 0;
}
}