更新时间:2022-05-02 22:08:51
您可以注册通知 UIDeviceOrientationDidChangeNotification
$ c> UIDevice.h ),然后当你关心方向变化时调用这个方法:
You can register for the notification UIDeviceOrientationDidChangeNotification
(from UIDevice.h
), and then when you care about orientation changes call this method:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
当您不再关心方向更改时,请调用此方法:
When you no longer care about orientation changes, call this method:
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
通知将在适当时发送,您可以检查 [UIDevice currentDevice ] .orientation
,找出当前的方向。
The notification will be sent when applicable, and you can check [UIDevice currentDevice].orientation
to find out what the current orientation is.