OS X WebView滚动条重新绘制/闪烁/闪烁问题 [英] OS X WebView scrollbar redrawing/flickering/flashing issue

查看:135
本文介绍了OS X WebView滚动条重新绘制/闪烁/闪烁问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OS X Yosemite上的WebView滚动条遇到问题. WebView是在XIB文件中设置的,保留默认设置.然后使用以下内容加载内容:

I'm having an issue with scrollbar of an WebView on OS X Yosemite. The WebView is setup in a XIB file, kept default settings. And then load the content with:

[self.webView.mainFrame loadHTMLString:html baseURL:nil];

但是在滚动时,我看到滚动条的重新绘制/闪烁/闪烁问题:示例视频. (这种情况发生在所有内容上,我只是用随机数据记录下来了)

But when scrolling I see redrawing/flickering/flashing issue of the scrollbar: example video. (This happens with all kind of content, I just recorded it with this random data)

推荐答案

要弄清楚这一点很棘手,但实际上是这样:首先创建一个仅包含WebView的新项目,以查看是否可以复制它.我无法在那里复制它.

This one was tricky to figure out, but here it goes: At first created a new project with just a WebView to see if I could reproduce it. I wasn't able to reproduce it there.

我转回我的项目,并用只包含WebView的新xib替换了麻烦的xib.再次,我无法重现该问题.

I switched back to my project and replaced the troublesome xib with a fresh one just containing a WebView. Again I wasn't able to reproduce the problem.

下一步是在新的xib中重新创建完整的UI的更耗时的任务.这个xib也无法重现该问题.问题已解决!

Next up was the more time consuming task of recreating the complete UI in a fresh xib. The problem wasn't reproducible with this xib either. Issue solved!

但是是什么引发了问题呢?盯着两个三角臂的diff一段时间后,我发现了一些东西:

But what triggered the problem? After staring at the diff of the two xibs for a while I noticed something:

<customView alphaValue="0.99999999999999989" translatesAutoresizingMaskIntoConstraints="NO" id="eEn-AF-z0I">

Interface Builder在Appearance部分中仍显示1Alpha.仅将其更改为其他内容并返回到1即可修复xib:

Interface Builder still showed in the Appearance section an Alpha of 1. Only changing it to something else and back to 1 fixed the xib:

<customView translatesAutoresizingMaskIntoConstraints="NO" id="eEn-AF-z0I">

我仍然不确定是什么改变了这个值,但是至少可以解决我的问题.同样,与图层相关的属性会导致此重绘问题也很有意义.

I'm still not sure what changed this value to begin with, but at least this fixes my issue. Also it makes sense layer related property causes this redrawing issue.

不支持层支持的WebView.从Leopard发行说明中:

Layer backed WebView's aren't supported. From the Leopard release notes:

AppKit和Mac OS X的其他Cocoa框架提供的大多数标准视图和控件都可以在Leopard中以层支持模式运行,但某些特定的视图(例如WebKit WebView和Quartz Composer QCViews)除外.目前不支持层支持模式.

Most of the standard views and controls that AppKit and Mac OS X's other Cocoa frameworks provide are able to function in layer-backed mode in Leopard, with the exception of certain specialized views such as WebKit WebViews and Quartz Composer QCViews, whose use in layer-backed mode is not presently supported.

http://developer.apple.com/mac/library/releasenotes/cocoa/AppKitOlderNotes.html#Animation -新视图动画工具和支持图层的视图图形"部分的最后一段

http://developer.apple.com/mac/library/releasenotes/cocoa/AppKitOlderNotes.html#Animation - Last paragraph of the "New View Animation Facilities, and Layer-Backed View Drawing" section

这篇关于OS X WebView滚动条重新绘制/闪烁/闪烁问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆