wxa*_*tly 32 cocoa-touch uiwebview uiscrollview ios
我建立加载的应用程序小简单的HTML(本地)的量为单一全屏的UIWebView.我注意到滚动此Web视图与滚动任何其他UIScrollView 有很大不同.这似乎不是性能或响应性问题本身......这只是在向上和向下拖动和轻弹Web视图时动量如何发挥作用的问题.它只是感觉不是非常"原生"(因为没有更好的词).这就像滚动糖蜜或布丁......有点"粘"而不像你想要的那样"光滑".
有谁知道是什么原因造成的?有没有办法解决它,或者至少使滚动UIWebView感觉更"原生"?
dan*_*anh 54
我有同感.它必须与webView的scrollView减速率有关.刚刚进行了这个测试,1)它证实了我们的怀疑,2)建议修复.
我在我的UI中添加了scrollView和webView,然后记录了以下内容:
NSLog(@"my scroll view's decel rate is %f", self.scrollView.decelerationRate);
NSLog(@"my web view's decel rate is %f", self.webView.scrollView.decelerationRate);
NSLog(@"normal is %f, fast is %f", UIScrollViewDecelerationRateNormal, UIScrollViewDecelerationRateFast);
Run Code Online (Sandbox Code Playgroud)
输出确认了关于webView更加摩擦的猜测:
my scroll view's decel rate is 0.998000
my web view's decel rate is 0.989324
normal is 0.998000, fast is 0.990000
Run Code Online (Sandbox Code Playgroud)
并建议修复:
self.webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7065 次 |
最近记录: |