Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
- func viewWillTransitionToSize(_ size: CGSize,
- withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator)
- NotificationCenter.default.addObserver(self, selector: #selector(orientationChanged), name: Notification.Name("UIDeviceOrientationDidChangeNotification"), object: nil)
- @objc func orientationChanged() {
- if(UIDeviceOrientationIsLandscape(UIDevice.current.orientation)){
- print("landscape")
- }
- if(UIDeviceOrientationIsPortrait(UIDevice.current.orientation)){
- print("Portrait")
- }
- }
Add Comment
Please, Sign In to add comment