MABSlider是使用Swift编写的OSX的自定义滑块。
安装将“MABNSSLider.swift”拖到您的Xcode项目中。使用界面生成器将NSSlider添加到视图。将类名称编辑为“MABSlider”,而不是“NSSlider”。如下编辑您的appdelegate:@IBOutletvarslider2:MABSlider!funcapplicationDidFinishLaunching(aNotification:NSNotification){slider2.setKnobImage(NSImage(named:"knob")!)slider2.setBarFillImage(NSImage(named:"fill")!)slider2.setBarFillBeforeKnobImage(NSImage(named:"beforeknob")!)slider2.setBarLeftAgeImage(NSImage(named:"leftage")!)slider2.setBarRightAgeImage(NSImage(named:"rightage")!)}@IBActionfuncslider2Changed(_sender:MABSlider){//yourcodegoeshereNSLog("\(slider2.floatValue)")}点击空白处退出提示
评论