Skip to content

Instantly share code, notes, and snippets.

@simrandotdev
Created February 19, 2018 17:01
Show Gist options
  • Save simrandotdev/17c958524b16b19affdbd28d40f4dd01 to your computer and use it in GitHub Desktop.
Save simrandotdev/17c958524b16b19affdbd28d40f4dd01 to your computer and use it in GitHub Desktop.
override func viewWillTransition(to size: CGSize,
with coordinator: UIViewControllerTransitionCoordinator) {
if UIDevice.current.orientation.isLandscape {
print("Landscape")
chatButton.removeTarget(self, action: #selector(handleChatButtonClick), for: .touchUpInside)
} else {
print("Portrait")
chatButton.addTarget(self, action: #selector(handleChatButtonClick), for: .touchUpInside)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment