Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35b0d46d8e | |||
| 047205a881 | |||
| ed64989887 | |||
| a4e1d06b19 |
BIN
Binary file not shown.
@@ -68,7 +68,7 @@ import QuartzCore
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var ignoreRatio: Bool = false {
|
||||
@IBInspectable public var ignoreRatio: Bool = true {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
@@ -108,23 +108,23 @@ import QuartzCore
|
||||
setup()
|
||||
}
|
||||
|
||||
override init(frame:NSRect) {
|
||||
super.init(frame: frame);
|
||||
setup()
|
||||
convenience public init(size: CGSize) {
|
||||
self.init(frame: NSRect(origin: .zero, size: size))
|
||||
}
|
||||
|
||||
override public func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
reloadLayerSize()
|
||||
reloadLayer()
|
||||
setupIcon()
|
||||
override public init(frame:NSRect) {
|
||||
super.init(frame: frame);
|
||||
setup()
|
||||
}
|
||||
|
||||
internal func setup() {
|
||||
isEnabled = true
|
||||
setupLayers()
|
||||
reloadLayerSize()
|
||||
setupIcon()
|
||||
reloadLayer()
|
||||
}
|
||||
|
||||
|
||||
public func setOn(isOn: Bool, animated: Bool) {
|
||||
if self.isOn != isOn {
|
||||
self.isOn = isOn
|
||||
|
||||
@@ -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` now also supports `IBDesignable` and renders directly in Interface Builder:
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## 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:
|
||||
|
||||

|
||||

|
||||
|
||||
The same values can be accessed from your code.
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 288 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
Reference in New Issue
Block a user