Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // detect device orientation
- override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
- if UIDevice.current.orientation.isLandscape {
- self.view.backgroundColor = UIColor(patternImage: UIImage(named: "back-landscape")!)
- } else {
- self.view.backgroundColor = UIColor(patternImage: UIImage(named: "back-potrait")!)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement