Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView scroll down

I use IUWebView like chat window and after adding new message in the bottom of view I wanna scroll down view programmicaly, how can I do it?

like image 490
vinnitu Avatar asked Feb 10 '26 08:02

vinnitu


2 Answers

Implement this method in your UIWebView Delegate.

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [webView stringByEvaluatingJavaScriptFromString:@"window.scrollTo(document.body.scrollWidth, document.body.scrollHeight);"];
}
like image 166
reedjsmith Avatar answered Feb 16 '26 01:02

reedjsmith


Have you tried something like this:

[mywebview stringByEvaluatingJavaScriptFromString:@"window.scrollTo(x, y);"]
like image 25
jarmod Avatar answered Feb 15 '26 23:02

jarmod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!