Skip to content

Instantly share code, notes, and snippets.

@artembolotov
Last active October 16, 2019 05:03
Show Gist options
  • Save artembolotov/4aa0f2d8d63d1d47474e4dfadbe71ccd to your computer and use it in GitHub Desktop.
Save artembolotov/4aa0f2d8d63d1d47474e4dfadbe71ccd to your computer and use it in GitHub Desktop.
private func setCloseButtonBackgroundImage() {
closeButton.setImage(StyleKit.imageOfCloseButton(color: .closeButtonNormal), for: .normal)
closeButton.setImage(StyleKit.imageOfCloseButton(color: .closeButtonHighlighted), for: .highlighted)
}
override func awakeFromNib() {
super.awakeFromNib()
setCloseButtonBackgroundImage()
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if #available(iOS 13.0, *) {
guard let prev = previousTraitCollection,
traitCollection.userInterfaceStyle != prev.userInterfaceStyle else { return }
setCloseButtonBackgroundImage()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment