-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
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
iOS Configure rotation. 旋转的配置看这里 (2.6.5版本及以后) #148
Comments
Step 1(第一步):Step 2(第二步):Step 3(第三步):@implementation UIViewController (RotationControl)
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
@end
@implementation UITabBarController (RotationControl)
- (UIViewController *)sj_topViewController {
if ( self.selectedIndex == NSNotFound )
return self.viewControllers.firstObject;
return self.selectedViewController;
}
- (BOOL)shouldAutorotate {
return [[self sj_topViewController] shouldAutorotate];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return [[self sj_topViewController] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return [[self sj_topViewController] preferredInterfaceOrientationForPresentation];
}
@end
@implementation UINavigationController (RotationControl)
- (BOOL)shouldAutorotate {
return self.topViewController.shouldAutorotate;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return self.topViewController.supportedInterfaceOrientations;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return self.topViewController.preferredInterfaceOrientationForPresentation;
}
- (nullable UIViewController *)childViewControllerForStatusBarStyle {
return self.topViewController;
}
- (nullable UIViewController *)childViewControllerForStatusBarHidden {
return self.topViewController;
}
@end
|
|
另外还有个问题,UITabBarController的某一个子tab包含播放器的时候,如果正在显示的tab是不包含播放器,旋转屏幕也会呼出全屏播放器界面。 |
@szdkkk 调一下这个几个方法试试. |
这样配置是不是app界面只能竖屏了 |
横屏的App参考ipad Demo |
@DarielChen 奇怪了...我这里没出现这个bug... 可以提供一下详细的操作吗, 或者加QQ群录个小视频看看 |
我这个问题主要是按照你提供的方式配置了全屏的操作,但我想禁止自动横屏,只在点击全屏按钮时才能横屏但不行,你能帮我看下么,到底啥问题哦
是这两个方法不调用?好奇怪 |
DarielChen :我这个问题主要是按照你提供的方式配置了全屏的操作,但我想禁止自动横屏,只在点击全屏按钮时才能横屏但不行,你能帮我看下么,到底啥问题哦同求解 |
@Ccalary 用交换方法重新实现一下我上面列的两个方法 |
@DarielChen 交换方法重新实现,不太明白,可以详细说说吗 |
|
第一次全屏动画卡顿是什么原因,跟没有动画一样,后面都正常 |
你好,我设置了自动选择 |
@chocolate1128 前三步的配置需添加上 |
@YangYueFan 可能是第一次旋转时, 执行的任务比较多卡顿了, 后续我再看看 |
测试全屏播放.mp4.zip |
找到问题了,有一个分类把supportedInterfaceOrientationsForWindow重写了,现在没问题了 |
配置完旋转的时候不走下面的两个方法 @changsanjiang
|
同问这个 |
@lianxiaoshuo TestController 加上这个 @implementation TMTestController
- (BOOL)shouldAutorotate {
return NO;
}
@end |
|
这个调用是从 tabBar 到 nav 再到 vc, 一层一层传上来的. 当在某个 vc 实现了 shouldAutorotation 方法, 分类的方法就不会触发. |
谢谢
| |
连硕
邮箱:[email protected]
|
签名由 网易邮箱大师 定制
在2020年06月23日 10:35,changsanjiang 写道:
这个调用是从 tabBar 到 nav 再到 vc, 一层一层传上来的. 当在某个 vc 实现了 shouldAutorotation 方法, 分类的方法就不会触发.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
点击旋转和自动旋转不是应该分开的吗?现在我按照这个配置了,点击全屏还是卡主了,页面其他的地方都不能点击了 |
|
ipad无法横屏全屏,只能竖屏全屏 |
v2.6.5版本及以后需要在项目中添加旋转的配置. 遇到点击无法触发旋转的请按照以下步骤进行配置.
The text was updated successfully, but these errors were encountered: