NSTokenField中的自定义标记 [英] Custom-drawn tokens in NSTokenField

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

问题描述

是否可以在 NSTokenField 中包含自定义标记?自定义"是指我想以自定义方式绘制它们-自定义悬停,背景图片等.

Is there a way to have custom tokens inside an NSTokenField? By "custom" I mean I would like to draw them in a custom way -- custom hover, background image, etc.

推荐答案

是的,这是可能的,但是您必须诉诸使用私有API,如果您打算将应用程序发布到Mac App Store.我已经就此事与苹果公司联系,他们已经确认没有私有API是无法做到这一点的-如果一个人只需要使用公共API就需要外观不同,则必须从头开始创建自己的控件.

Yes, this is possible, but you'll have to resort to using private APIs, which you don't want if you intend on publishing your app to the Mac App Store. I have contacted Apple about this, and they have confirmed that there is no way of doing this without private APIs - if one needs difference appearance using only public APIs, one must create one's own control from scratch.

如果您仍然想使用私有API进行此操作,请查看BWToolkit.BWTokenField使用这些专用API来修改令牌外观.那应该是一个很好的起点.但是要花点时间才能弄清楚一切并进行调整,直到获得理想的效果为止.

If you still want to do this using private APIs, look into BWToolkit. BWTokenField uses these private APIs to modify the token appearance. That should be a good starting point. But it takes a while to figure it all out and tweak things until one gets one's desired effect.

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

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