Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muhammadbassio/MABSlider
Custom Slider for OSX using swift
https://github.com/muhammadbassio/MABSlider
Last synced: 3 months ago
JSON representation
Custom Slider for OSX using swift
- Host: GitHub
- URL: https://github.com/muhammadbassio/MABSlider
- Owner: muhammadbassio
- License: mit
- Created: 2014-11-19T20:11:20.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-07-02T12:49:59.000Z (over 4 years ago)
- Last Synced: 2024-05-14T01:20:28.838Z (6 months ago)
- Language: Swift
- Size: 82 KB
- Stars: 23
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-macos-libraries - MABSlider - Custom Slider for OSX using swift (Slider)
README
MABSlider (swift)
=================A customized slider for OSX using png images written in swift.
## ScreenShot
![MABSlider](/SS.png)
## Install
- Drag "MABNSSLider.swift" to your Xcode project.## Using Interface Builder
- Add an NSSlider to your view.
- Edit the class name to be "MABSlider" instead of "NSSlider".
- Edit your appdelegate as below:```
@IBOutlet var slider2: MABSlider!func applicationDidFinishLaunching(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")!)
}
@IBAction func slider2Changed(_ sender: MABSlider) {
// your code goes here
NSLog("\(slider2.floatValue)")
}```
### Caution!
When using a MABSlider inside a custom Cocoa class and a xib file the action is not sent. To fix go in the interface builder, select the NSSliderCell inside the MABSlider this edit the class name to be "MABSliderCell".## Using Code
Edit your appdelegate as below:
```
var slider:MABSlider!func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application
slider = MABSlider(knob: NSImage(named: "knob")!, barFill: NSImage(named: "fill")!, barFillBeforeKnob: NSImage(named: "beforeknob")!, barLeftAge: NSImage(named: "leftage")!, barRightAge: NSImage(named: "rightage")!);
slider.frame = NSMakeRect(20, 20, 200, 21);
slider.action = "sliderChanged"
window.contentView?.addSubview(slider);
}
func sliderChanged() {
// your code goes here
NSLog("\(slider.floatValue)")
}
```##License
MIT License (MIT)
```
Copyright (c) 2014 MuhammadBassioPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.<<<<<<< HEAD
```
=======
```
>>>>>>> FETCH_HEAD