daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Mar 8th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
  2.    
  3. func viewWillTransitionToSize(_ size: CGSize,
  4.     withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator)
  5.    
  6. NotificationCenter.default.addObserver(self, selector: #selector(orientationChanged), name:  Notification.Name("UIDeviceOrientationDidChangeNotification"), object: nil)
  7.    
  8. @objc func orientationChanged() {
  9.  
  10.     if(UIDeviceOrientationIsLandscape(UIDevice.current.orientation)){
  11.  
  12.         print("landscape")
  13.     }
  14.  
  15.     if(UIDeviceOrientationIsPortrait(UIDevice.current.orientation)){
  16.  
  17.         print("Portrait")
  18.     }
  19.  
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top