UISwitch,Mac 上有类似的东西吗?
我相信大多数人都熟悉 iOS 上的 UISwitch
。
他们现有的项目是否尝试为 macOS 和 AppKit 实现类似 UISwitch
的东西?
如果没有,从哪里开始制作呢?我经常看到它们并且能想到很多用途。
I’m sure most of you are familiar with the UISwitch
on iOS.
Is their any existing project trying to implement something like a UISwitch
for macOS and AppKit?
If not, where would one start to make one? I see them frequently and can think of so many uses.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我认为你应该使用
NSCheckBox
因为它相当于你使用鼠标而不是手指的计算机上。I think you should use
NSCheckBox
since it is the equivalent on a computer where you use a mouse and not your finger.对于将来遇到这个问题的任何人,我开发了一个用于 Mac 的 UISwitch (MacToggle) Swift 3 &自动布局
https://github.com/RichAppz/MacToggle
它是 iOS UISwitch 的复制品,并且完全可定制。
享受
For anyone that comes across this question in the future, I have developed a UISwitch for Mac (MacToggle) Swift 3 & AutoLayout
https://github.com/RichAppz/MacToggle
It's a replica of the iOS UISwitch and fully customisable.
Enjoy
我使用了 Mondo Switch,它是 Cocoa Mondo Kit 的一部分。它运作得很好。
I've used the Mondo Switch that's part of the Cocoa Mondo Kit. It works pretty well.
我最近扩展了 Peter Hosey 的PRHOnOffButton 添加类似 iOS 的背景颜色和标签。由于我的内容是派生的,因此它可能有也可能没有彼得上述的相同警告。
I recently extended Peter Hosey's PRHOnOffButton to add iOS-like background colors and labels. Since mine is derived, it may or may not have the same caveat described above by Peter.
您可以使用 Peter Hosey 的 PRHOnOffButton。
You could use Peter Hosey’s PRHOnOffButton.
ITSwitch
不需要图像,与 Interface Builder 集成并具有可爱的(现代)动画:推荐。
ITSwitch
requires no images, integrates with Interface Builder and has lovely (modern) animations:Recommended.
从 macOS 10.15“Catalina”开始,有一个名为
NSSwitch
的本机控件:https://developer.apple.com/documentation/appkit/nsswitch?language=objcstarting with macOS 10.15 'Catalina' there is a native control for that called
NSSwitch
: https://developer.apple.com/documentation/appkit/nsswitch?language=objc