Tuesday 15 September 2015

iphone - How to increase scrolling speed on uiwebview -


मैंने UIWebview पर स्क्रोलिंग गति के लिए bellow कोड का उपयोग किया, पिछले स्क्रोलिंग के ठीक और अच्छे से तुलना की, लेकिन मेरा क्लिनर संतुष्ट नहीं था वह इस तरह से पूछा

स्क्रॉलिंग अभी भी कठोर लगता है

  webviews.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal; [वेबव्यू लोड लोड करें: [एनएसयूआरआर अनुरोध अनुरोध विथ url: [एनएसड URL URL विथ स्ट्रिंग: @ "साइट यूआरएल"]]]; Webviews.scalesPageToFit = हाँ; `  

क्या स्क्रॉलिंग गति बढ़ाने का कोई विकल्प है?

इन गुणों को अपने UIScrollViewDelegate पर रखें

  CGPoint lastOffset; NSTimeInterval lastOffsetCapture; BOOL है ScrollingFast;   

फिर अपने scrollViewDidScroll के लिए यह कोड है:

  - (शून्य) scrollViewDidScroll: (UIScrollView *) scrollView {CGPoint currentOffset = self.currentChannelTableView.contentOffset; NSTimeInterval वर्तमान टाईम = [एनएसडीटी समयइंटरवलसाथरेफरेंसडेट]; एनएसटीईएमइनटार्वल टाइमडफ = वर्तमानटाइम - पिछलेऑफसेटकैचर; यदि (टाइमडिफ> 0.1) {CGFloat distance = currentOffset.y - lastOffset.y; // 10 से गुणा, / 1000 वास्तव में आवश्यक नहीं है ....... CGFloat scrollSpeedNotAbs = (दूरी * 10) / 1000; // पिक्सल प्रति मिलीसेकंड CGFloat scrollSpeed ​​= fabsf (scrollSpeedNotAbs); अगर (scrollSpeed ​​& gt; 0.5) {है ScrollingFast = YES; NSLog (@ "फास्ट"); } Else {है ScrollingFast = NO; NSLog (@ "स्लो"); } LastOffset = currentOffset; LastOffsetCapture = वर्तमान समय; }}    

No comments:

Post a Comment