自定义NSPathControl [英] Customise NSPathControl

查看:115
本文介绍了自定义NSPathControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个自定义的NSPathControl. NSPathCell具有方法+ pathComponentCellClass,您可以在其中返回组件单元格的自定义类. 我有一个NSPathComponentCell子类,我在那儿返回了它,但是它不起作用. 该方法不会被调用.为什么?

I would like to make a custom NSPathControl. NSPathCell has the method + pathComponentCellClass, where you can return the custom class of the component cells. I have a NSPathComponentCell subclass, which I return right there, but it doesn't work. The method does not get called. Why?

文档说:

子类可以重写此方法以返回自动使用的自定义单元格类.默认情况下,该方法返回[NSPathComponentCell class]或其专门的子类.

Subclasses can override this method to return a custom cell class that is automatically used. By default, the method returns [NSPathComponentCell class], or a specialized subclass thereof.

如果这是错误的,还有另一种自定义NSPathControl的方法吗?

If this is wrong, is there another way to customise NSPathControl?

推荐答案

我找到了解决方案并将其发布在 github . 我从NSPathControl继承了子类.其实很简单.

I found the solution and posted it on github. I subclassed from NSPathControl. It's pretty simple actually.

这篇关于自定义NSPathControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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