標籤:設定 播放 elf ack har ide iap oid 自己
視頻播放想要全屏,使用shouldAutorotate方法禁止主介面,tabbar控制器橫屏,導致push進入播放頁面不能橫屏的問題。。。
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
後面解決方案:
- (void)fullScreenClick:(UIButton *)sender {
sender.selected = !sender.selected;
if (sender.isSelected) {
_backButton.hidden = YES;
[self forceOrientationLandscapeLeft];
} else {
_backButton.hidden = NO;
[self forceOrientationPortrait];
}
}
//MARK: -- 強制橫屏
- (void)forceOrientationLandscapeLeft
{
AppDelegate *appdelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;
appdelegate.isForcePortrait=NO;
appdelegate.isForceLandscape=YES;
[appdelegate application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:self.view.window];
YNCNavigationViewController *navi = (YNCNavigationViewController *)self.navigationController;
navi.interfaceOrientation = UIInterfaceOrientationMaskLandscape;
navi.interfaceOrientationMask = UIInterfaceOrientationMaskLandscape;
//設定螢幕的轉向為橫屏
[[UIDevice currentDevice] setValue:@(UIDeviceOrientationLandscapeLeft) forKey:@"orientation"];
//重新整理
[UIViewController attemptRotationToDeviceOrientation];
}
//MARK: -- 強制豎屏
- (void)forceOrientationPortrait
{
AppDelegate *appdelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;
appdelegate.isForcePortrait=YES;
appdelegate.isForceLandscape=NO;
[appdelegate application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:self.view.window];
YNCNavigationViewController *navi = (YNCNavigationViewController *)self.navigationController;
navi.interfaceOrientation = UIInterfaceOrientationPortrait;
navi.interfaceOrientationMask = UIInterfaceOrientationMaskPortrait;
//設定螢幕的轉向為豎屏
[[UIDevice currentDevice] setValue:@(UIDeviceOrientationPortrait) forKey:@"orientation"];
//重新整理
[UIViewController attemptRotationToDeviceOrientation];
}
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (assign , nonatomic) BOOL isForceLandscape;
@property (assign , nonatomic) BOOL isForcePortrait;
@end
AppDelegate.m
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
if (self.isForceLandscape) {
return UIInterfaceOrientationMaskLandscape;
}else if (self.isForcePortrait){
return UIInterfaceOrientationMaskPortrait;
}
return UIInterfaceOrientationMaskPortrait;
}
@interface YNCNavigationViewController : UINavigationController
//旋轉方向 預設豎屏
@property (nonatomic , assign) UIInterfaceOrientation interfaceOrientation;
@property (nonatomic , assign) UIInterfaceOrientationMask interfaceOrientationMask;
@end
.m
#pragma mark - 由子控制器控制自己的轉屏邏輯
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return self.interfaceOrientationMask;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return self.interfaceOrientation;
}
iOS - 視頻播放處理全屏/橫屏時候遇見的坑