- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
if ([webView.URL isEqual:self.url]) {
CGFloat offsetY = 0;
offsetY = [[NSUserDefaults standardUserDefaults] floatForKey:@"webViewOffsetY"];
if (offsetY) {
[webView.scrollView setContentOffset:CGPointMake(0, offsetY) animated:NO];
}
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
CGFloat offsetY = scrollView.contentOffset.y;
[[NSUserDefaults standardUserDefaults] setFloat:offsetY forKey:@"webViewOffsetY"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
网友评论