Scrolling a webpage inside UIWebView

Scrolling a webpage inside UIWebView

I have a UIWebView and UIButton added as subview to my View. I also have a large webpage displayed inside my UIWebView, is it possible to scroll the webpage by clicking a button on the UIView?

I want to make the webpage scroll untill it reaches the bottom of the document.

The javascript to be used is : window.scrollTo(xPos, yPos);

Is it possible to make a javascript call on the button action which will scroll the web document inside the UIWebView?

Best Security Framework to secure and authenticate an iPhone app which uses REST?


How to determine UIWebView height based on content, within a variable height UITableView?
You must use this on your UIWebview component:. Send iPhone HTTP request to Apache PHP webserver
NSString *yourScript = [NSString stringWithFormat:@"javascript_method();"];  NSString* responseJS = [webView stringByEvaluatingJavaScriptFromString:yourScript]; 
How is layoutIfNeeded used?Login / Logout on an iPhone app


Count the number of times a method is called in Cocoa-Touch?
Scroll the UIWebView by calling JavaScript through Objective-C:. Scrolling to range in UITextView
NSString *script = @"scrollTo(0, 0)"; [webView stringByEvaluatingJavaScriptFromString:script]; 
For smooth scrolling, use a library like jQuery:. should we need to release viewcontroller's object after pushing into navigation controller?
NSString *script = @"$('html, body').animate({scrollTop:0}, 'slow')"; [webView stringByEvaluatingJavaScriptFromString:script]; 


I had a similar requirement when I wanted to scroll the UIWebview Programmatically as I had no control over the web-pages I was loading. I wanted a way to did it in my ObjC code.. Solution: UIWebview has is own UIScrollView i must play with it 1. Set the Edge inset for the _webview to whatever you want. 2. Then tell the _webview to scroll to the specified position..
[[_webView scrollView]setContentInset:UIEdgeInsetsMake(-300, 0, 0, 0)]; [[_webView scrollView]scrollRectToVisible:CGRectMake(0, -300, 768, 1024) animated:YES]; 

98 out of 100 based on 63 user ratings 658 reviews