令牌字段的可拖动元素,如 Mac 时钟格式面板
I need to be able to make a token field with draggable elements like the Mac clock format panel (see the following image).
Thanks so much, Alex.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们称为令牌字段。苹果有一个 他们的指南。 (在不知道您目标的更多细节的情况下,这已经是我所能得到的最精确的了。)
编辑
我注意到对您的问题进行了编辑。您想要一些行为类似于系统偏好设置的日期面板的东西。 我想象中正在发生的情况的细分:
我想,上面链接的指南包含处理令牌字段中的非字符串元素的信息。要做的就是为要表示的数据部分创建模型,然后使用(可能是自定义的)视图呈现它们。
They're called token fields. Apple has a guide for them. (Without knowing any more details of your goals, that's about as precise as I can get.)
Edit
I noticed the edits to your question. You want something that behaves like System Preference's date panel. Here's a breakdown of what I imagine is happening:
NSTokenField
objects can accept arbitrary objects, as well as strings. So you can drag these objects from the "Time Elements" section onto the token field. The token field's delegate than handles these non-string objects.The guide linked above contains the information for handling non-string elements in token fields. I imagine all you need to do is create models for the data parts you want to represent, and then render them using a (possibly custom) view.