I answer my question, as I can reproduce this problem and found the root cause.
Pay attention to the following.
1. I am using UIWebView. First of all, it is not recommended.
2. The following implementation method causes this problem. Here I write pseudo code to demonstrate the problem.
@implementation MyViewController
- (void)loadView {
self.webView = [[UIWebView alloc] initWithFrame:_some_frame];
[self.view addSubView: self.webView];
[self populateWebView];
}
- (void) populateWebView {
[self.webView loadHTMLString:_some_html
baseURL:[NSURL fileURLWithPath:_some_path]];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
if (self.webView) {
self.webView.scrollView.contentInset = _some_insets;
self.webView.scrollView.scrollIndicatorInsets = _some_insets;
}
}
@end
3. The solution is given below.
@implementation MyViewController
- (void)loadView {
self.webView = [[UIWebView alloc] initWithFrame:_some_frame];
[self.view addSubView: self.webView];
[self populateWebView];
}
- (void) populateWebView {
[self.webView loadHTMLString:_some_html
baseURL:[NSURL fileURLWithPath:_some_path]];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
webView.scrollView.contentInset = _some_insets;
webView.scrollView.scrollIndicatorInsets = _some_insets;
}
@end
WebView, UIWebView. , . contentInset "" scrollIndicatorInsets " viewDidLayoutSubviews, . ," viewDidLayoutSubviews" , , .
" webViewDidFinishLoad", , WebView . .
webView.scrollView.contentInset = _some_insets;
webView.scrollView.scrollIndicatorInsets = _some_insets;