YPNavigationBarTransition
YPNavigationBarTransition copied to clipboard
使用这个框架后代码强制横屏失败
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"]; }
这个库没有涉及到屏幕的方向