3 Commits

Author SHA1 Message Date
Oskar Groth 35b0d46d8e fix images 2024-09-20 11:36:13 +02:00
Oskar 047205a881 Default ratio off 2018-08-08 21:59:18 +02:00
Oskar ed64989887 Initialization fix 2018-08-08 21:54:09 +02:00
6 changed files with 8 additions and 12 deletions
+5 -9
View File
@@ -68,7 +68,7 @@ import QuartzCore
reloadLayer()
}
}
@IBInspectable public var ignoreRatio: Bool = false {
@IBInspectable public var ignoreRatio: Bool = true {
didSet {
reloadLayer()
}
@@ -117,18 +117,14 @@ import QuartzCore
setup()
}
override public func awakeFromNib() {
super.awakeFromNib()
reloadLayerSize()
reloadLayer()
setupIcon()
}
internal func setup() {
isEnabled = true
setupLayers()
reloadLayerSize()
setupIcon()
reloadLayer()
}
public func setOn(isOn: Bool, animated: Bool) {
if self.isOn != isOn {
self.isOn = isOn
+3 -3
View File
@@ -7,11 +7,11 @@ Supports animation, custom aspect ratios, and knob images.
This is a `NSView` subclass that lets you create beautiful iOS-inspired switches easily.
![OGSwitch for macOS](https://s3.amazonaws.com/cindori/images/ogswitch.png "OGSwitch for macOS")
![OGSwitch for macOS](ogswitch.jpg)
`OGSwitch` now also supports `IBDesignable` and renders directly in Interface Builder:
![IBDesignable](https://i.imgur.com/BKUyWGg.png "IBDesignable")
![OGSwitch for macOS](ogswitch-dark.png)
## Installation (Carthage)
@@ -26,7 +26,7 @@ Configure your Cartfile to use `OGSwitch`:
Create a custom `NSView` in Interface Builder and set it's class to `OGSwitch`.
You can now style your switch from the inspector:
![OGSwitch for macOS](https://s3.amazonaws.com/cindori/images/inspector-ogswitch.png "OGSwitch for macOS")
![OGSwitch for macOS](inspector.png)
The same values can be accessed from your code.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

View File

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB