I had a similar requirement when I wanted to scroll through the UIWebview Programmatically, since I did not have control over the web pages I loaded. I need a way to do this in ObjC code.
Solution: UIWebview has its own UIScrollView , we can play with it 1. Set the Edge tab for _webview as you like. 2. Then tell _webview scroll to the specified position.
[[_webView scrollView]setContentInset:UIEdgeInsetsMake(-300, 0, 0, 0)]; [[_webView scrollView]scrollRectToVisible:CGRectMake(0, -300, 768, 1024) animated:YES];
thesummersign
source share