核心动画导致部分源列表焦点环

发布于 2024-11-03 04:47:39 字数 1170 浏览 1 评论 0原文

我在自定义 NSOutlineView 中使用了 Apple 教程之一中稍微修改过的 ImageAndTextCell。对于那些不熟悉它的人来说,它是一个 NSTextFieldCell 子类,用于在单元格文本的左侧绘制图像。

我有一个像 iTunes 一样的源列表,其中包含组行和下方的项目。编辑单元格的值时,焦点环仅部分绘制该组的前两行(见下文)。聚焦环的顶部三分之一绘制在第一行中,底部三分之一绘制在第二行中。

后续行绘制得很好(请参见下面的第三行),并且它们都具有相同的图像。可能是什么原因造成的? (请参阅下面的更新 3。核心动画导致此行为)

enter此处图像描述 此处输入图像描述 输入图片这里的描述

更新 1

我注释掉了 ImageAndTextCell 中的几乎所有自定义代码,这没有什么区别(只有 initdealloc< /code>、copyWithZoneimage getter 和 setter 仍然保留)。

更新 2

我几乎注释了 NSOutlineView 子类和我的委托类中的所有代码,并保留了更新 1 中的所有代码注释 - 仍然是奇怪的结果。第三行不再总是完美的,但是当我删除各种函数时,绘制的焦点矩形的部分发生了变化。

另外,我遇​​到问题的项目位于我的两个大纲组的第二个中。当重命名第一组中的唯一项目时,焦点矩形的每一步都很完美。具有讽刺意味的是,这是在我的应用程序的标准操作过程中无法重命名的。

接下来,我将查看 NIB 中的所有设置,看看是否存在某些问题。

更新 3

我能够通过全面禁用窗口中每个视图的核心动画来修复它。现在的问题是:如何重新启用核心动画而不让我的焦点矩形看起来很糟糕?

I'm using a slightly modified ImageAndTextCell from one of Apple's tutorials in a custom NSOutlineView. For those unfamiliar with it, it's an NSTextFieldCell subclass that draws an image to the left of the cell's text.

I have a Source List like iTunes's, with group rows, and items beneath. While editing the cell's value, the focus ring only draws partially for the group's first two rows (see below). The top third of the focus ring draws in the first row, and the bottom third draws in the second row.

Subsequent rows draw fine (see the third row below), and they all have the same image. What could be causing this? (See Update 3 below. Core Animation is causing this behavior)

enter image description here enter image description here enter image description here

Update 1

I commented out virtually all custom code in ImageAndTextCell and it made no difference (Only init, dealloc, copyWithZone, and the image getter and setter remained).

Update 2

I commented virtually all code in the NSOutlineView subclass, and my delegate class, as well as keeping all code from Update 1 commented out - still strange results. The third row is no longer always perfect, but the portions of the focus rect drawn shifted as I removed various functions.

Also, the items I'm having problems with are in the second of my two outline groups. When renaming the only item in the first group, the focus rect was perfect every step of the way. Ironically, this is the one that can't be renamed during standard operation of my app.

Next I'll take a look at all of my settings in the NIB and see if something might be broken there.

Update 3

I was able to fix it by disabling Core Animation across the board for every view in my window. The question has now become: How do I re-enable Core Animation without making my focus rects look crappy?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情别恋 2024-11-10 04:47:39

在迁移到 Lion 之前没有解决这个问题,我现在可以高兴地报告,切换到基于视图的 NSOutlineView 可以解决这个问题。奇怪的是,如果您在 IB 中为大纲视图打开图层支持,则会产生其他问题。然而,在取消选中这些框后,界面仍然会显示动画(并且支持比基于单元格的轮廓视图更丰富的动画)。

Not having solved this before moving to Lion, I can now happily report that switching to a view-based NSOutlineView fixes this problem. Oddly, if you turn on layer-backing in IB for the outline view, it creates other problems. The interface still animates, however, after unchecking those boxes (and has support for far richer animations than the cell-based outline view).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文