Update for iOS 17.
This commit is contained in:
@@ -69,12 +69,14 @@ class ReliefButton: UIButton
|
||||
backgroundView.layer.rasterizationScale = UIScreen.main.scale
|
||||
addSubview(backgroundView)
|
||||
|
||||
traitCollectionDidChange(nil)
|
||||
registerForTraitChanges([UITraitUserInterfaceStyle.self], handler: handleTraitCollectionChange)
|
||||
|
||||
pointerStyleProvider = { (button, pointerEffect, pointerShape) -> UIPointerStyle? in
|
||||
let preview = UITargetedPreview(view: button)
|
||||
return UIPointerStyle(effect: .lift(preview), shape: pointerShape)
|
||||
}
|
||||
|
||||
handleTraitCollectionChange(self, previousCollection: nil)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
@@ -99,7 +101,7 @@ class ReliefButton: UIButton
|
||||
return inverted ? colors.reversed() : colors
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
private func handleTraitCollectionChange(_ environment: UITraitEnvironment, previousCollection: UITraitCollection?) {
|
||||
setBackgroundInverted(isHighlighted)
|
||||
backgroundView.layer.borderColor = { traitCollection -> UIColor in
|
||||
if traitCollection.userInterfaceStyle == .dark {
|
||||
@@ -107,7 +109,7 @@ class ReliefButton: UIButton
|
||||
} else {
|
||||
return .white
|
||||
}
|
||||
}(traitCollection).cgColor
|
||||
} (traitCollection).cgColor
|
||||
}
|
||||
|
||||
internal func setBackgroundInverted(_ inverted: Bool) {
|
||||
|
||||
Reference in New Issue
Block a user