UIDevice currentDevice's “orientation” always null

后端 未结 5 1749
一生所求
一生所求 2020-12-18 00:23

As per the title. Calling [[UIDevice currentDevice] BeginGeneratingDeviceOrientationNotifications] has no effect.

DidRotateToInterfaceOrientation etc events are wor

5条回答
  •  遥遥无期
    2020-12-18 00:41

    Wouldn't [[UIDevice currentDevice] orientation] give you the current orientation state? You could check for this in your viewWillAppear method of the view controller that wants to poll.

    Edit: Other than that, there are various ways to get the current orientation, such as using the statusBarOrientation property in UIApplication, or interfaceOrientation property in UIViewcontroller.

提交回复
热议问题