So, I have a UIView with a UIWebView inside, serving a local HTML file (document preview). I also have Accept and Reject UIButtons. I need these buttons to appear only after the user scrolls to the bottom of the web page. Is there a way to capture a scroll event at the bottom of a UIWebView?
I have not seen any good answers for this, can anyone help?
Thanks in advance.
UIWebView UIScrollViewDelegate. , UIWebView (, ScrollDetectWebView) UIScrollViewDelegate.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { [super scrollViewDidScroll: scrollView]; // Whatever scroll detection you need to do }
?
JavaScript allows you to handle a scroll event and send an Objective-c message.
- (void)viewDidLoad { [super viewDidLoad]; self.webView.scrollView.delegate = self; } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { CGSize fittingSize = [self.webView sizeThatFits:CGSizeZero]; CGFloat height1 = scrollView.bounds.origin.y + self.webView.bounds.size.height; CGFloat height2 = fittingSize.height; int delta = fabs(height1 - height2); if (delta < 30) { NSLog(@"HELLO!!! You reached the page end!"); } }
Source: https://habr.com/ru/post/1771358/More articles:django fails, sometimes very erratic behavior - djangoimplementation of the TRIE data structure - cЭффективная синхронизация кеша - javaGood methods or tutorials for understanding JOINs in SQL - sqlPlayable Map Height - c #How can we change the data in the shelf? - pythonIphone Crash Magazine Does Not Symbolize UIKit Calls - objective-cHow to create a method or property in C # that is public but not inherited? - inheritance- (void) applicationDidEnterBackground: (приложение UIApplication *) - iosWriting a DLL for C # and C ++ Applications - c ++All Articles