[英]how to rotate to current of Orientation?
according to my code when my device are use in Landscape 当我的设备在横向模式下使用时,根据我的代码
when i pushViewController it will 当我pushViewController它将
automatic show in UIDeviceOrientationPortrait. 自动显示在UIDeviceOrientationPortrait中。
i need to rotate my device to Portrait and then rotate to Landscape, 我需要将设备旋转到纵向,然后旋转到横向,
then it will present in Landscape mode. 那么它将以横向模式显示。
how can i rotate to current of Orientation with out use of private API(setOrientation)? 如何在不使用私有API(setOrientation)的情况下旋转到当前的Orientation?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIDeviceOrientationPortrait) ||
(interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
Try setting the status bar orientation: 尝试设置状态栏方向:
UIApplication *app = [UIApplication sharedApplication];
[app setStatusBarOrientation: UIInterfaceOrientationLandscape];
[app setStatusBarHidden: NO animated: YES];
You can get the current device orientation like this: 您可以像这样获取当前的设备方向:
[UIDevice currentDevice].orientation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.