问题
Im sure most of you are familiar with the UISwitch
on iOS. Is their any existing project trying to implement something like this on Mac? If not, where would one start to make one? I see them frequently and can think of so many uses.
Thanks in advance
回答1:
I've used the Mondo Switch that's part of the Cocoa Mondo Kit. It works pretty well.
回答2:
I think you should use NSCheckBox
since it is the equivalent on a computer where you use a mouse and not your finger.
回答3:
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.
回答4:
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
回答5:
You could use Peter Hosey’s PRHOnOffButton.
回答6:
ITSwitch
requires no images, integrates with Interface Builder and has lovely (modern) animations:
https://github.com/iluuu1994/ITSwitch
Recommended.
回答7:
starting with macOS 10.15 'Catalina' there is a native control for that called 'NSSwitch': https://developer.apple.com/documentation/appkit/nsswitch?language=objc
来源:https://stackoverflow.com/questions/4811942/uiswitch-something-similar-for-mac