Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. // detect device orientation
  2. override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  3.  
  4. if UIDevice.current.orientation.isLandscape {
  5. self.view.backgroundColor = UIColor(patternImage: UIImage(named: "back-landscape")!)
  6.  
  7. } else {
  8. self.view.backgroundColor = UIColor(patternImage: UIImage(named: "back-potrait")!)
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement