简体   繁体   中英

Javascript scroll event when scroll was programmatic in iOS

I have an iOS app that involves a UIWebView. There is javascript in the web view that reacts to scroll events. There is a way to make the web view scroll by tapping on one side or the other of the web view. The problem is that the javascript in the web view does not seem to pick up the scroll event when the scroll was done programmatically.

This is the code I use to scroll the web view:

[self.webView.scrollView setContentOffset:CGPointMake(targetX, y);

Is there a different way to do this so that the javascript reacts to the scroll? Or am I going to have to run javascript on the web view programmatically when the scroll event finishes?

您是否尝试过:

[self.webView.scrollView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM