Detecting iOS UIDevice orientation

后端 未结 8 938
一生所求
一生所求 2020-11-28 03:29

I need to detect when the device is in portrait orientation so that I can fire off a special animation. But I do not want my view to autorotate.

How do I override a

8条回答
  •  无人及你
    2020-11-28 04:22

    In Swift 5.0.

    DeviceOrientation vs. ScreenSize vs StatusBar.isLandscape?

    If you want to detect changes of orientation in background, and also need to detect face up/down changes, check this link In Swift, how to get the device orientation correctly right after it's launched?

    It covers how to correctly detect the orientation in Swift using 3 alternate ways to do it: - viewWillTransitionToSize() - Using Observer - Using the status bar

提交回复
热议问题