We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; // 打开横屏开关 appDelegate.allowRotation = YES; // 调用转屏代码 [UIDevice deviceMandatoryLandscapeWithNewOrientation:UIInterfaceOrientationLandscapeRight];
/// 输入要强制转屏的方向 /// @param interfaceOrientation 转屏的方向
(void)deviceMandatoryLandscapeWithNewOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSNumber *resetOrientationTarget = [NSNumber numberWithInt:UIInterfaceOrientationUnknown];
[[UIDevice currentDevice] setValue:resetOrientationTarget forKey:@"orientation"];
// 将输入的转屏方向(枚举)转换成Int类型 int orientation = (int)interfaceOrientation;
// 对象包装 NSNumber *orientationTarget = [NSNumber numberWithInt:orientation];
// 实现横竖屏旋转 [[UIDevice currentDevice] setValue:orientationTarget forKey:@"orientation"]; }
The text was updated successfully, but these errors were encountered:
这个库没有涉及到屏幕的方向
Sorry, something went wrong.
No branches or pull requests
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
// 打开横屏开关
appDelegate.allowRotation = YES;
// 调用转屏代码
[UIDevice deviceMandatoryLandscapeWithNewOrientation:UIInterfaceOrientationLandscapeRight];
/// 输入要强制转屏的方向
/// @param interfaceOrientation 转屏的方向
(void)deviceMandatoryLandscapeWithNewOrientation:(UIInterfaceOrientation)interfaceOrientation {
NSNumber *resetOrientationTarget = [NSNumber numberWithInt:UIInterfaceOrientationUnknown];
[[UIDevice currentDevice] setValue:resetOrientationTarget forKey:@"orientation"];
// 将输入的转屏方向(枚举)转换成Int类型
int orientation = (int)interfaceOrientation;
// 对象包装
NSNumber *orientationTarget = [NSNumber numberWithInt:orientation];
// 实现横竖屏旋转
[[UIDevice currentDevice] setValue:orientationTarget forKey:@"orientation"];
}
The text was updated successfully, but these errors were encountered: