摄像头横竖屏适配
This commit is contained in:
+28
-3
@@ -1289,9 +1289,22 @@ Strong UIImage *screenShotImage;//截图
|
||||
//设置横屏
|
||||
[AppDelegate sharedDefault].canFullScreen = YES;
|
||||
static int isFullScreen = 3; // 3 == 全屏 1 == 竖屏
|
||||
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
|
||||
if (@available(iOS 16.0, *)) {
|
||||
[self setNeedsUpdateOfSupportedInterfaceOrientations];
|
||||
[self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];
|
||||
|
||||
NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
|
||||
UIWindowScene *scene = (UIWindowScene *)array[0];
|
||||
UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:UIInterfaceOrientationMaskLandscape];
|
||||
[scene requestGeometryUpdateWithPreferences:geometryPreferences
|
||||
errorHandler:^(NSError * _Nonnull error) {
|
||||
NSLog(@"wuwuFQ:%@", error);
|
||||
}];
|
||||
|
||||
} else if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
|
||||
{
|
||||
NSNumber *numb=[NSNumber numberWithInteger:UIInterfaceOrientationLandscapeRight];
|
||||
isFullScreen = UIInterfaceOrientationLandscapeRight;
|
||||
[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
|
||||
withObject:numb];
|
||||
|
||||
@@ -1327,11 +1340,23 @@ Strong UIImage *screenShotImage;//截图
|
||||
//设置竖屏
|
||||
[AppDelegate sharedDefault].canFullScreen = NO;
|
||||
static int isFullScreen = 1; // 3 == 全屏 1 == 竖屏
|
||||
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
|
||||
if (@available(iOS 16.0, *)) {
|
||||
[self setNeedsUpdateOfSupportedInterfaceOrientations];
|
||||
[self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];
|
||||
|
||||
NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
|
||||
UIWindowScene *scene = (UIWindowScene *)array[0];
|
||||
UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:UIInterfaceOrientationMaskPortrait];
|
||||
[scene requestGeometryUpdateWithPreferences:geometryPreferences
|
||||
errorHandler:^(NSError * _Nonnull error) {
|
||||
NSLog(@"wuwuFQ:%@", error);
|
||||
}];
|
||||
|
||||
} else if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
|
||||
{
|
||||
NSLog(@"self.interfaceOrientation%ld",(long)UIDeviceOrientationPortrait);
|
||||
|
||||
|
||||
isFullScreen = UIDeviceOrientationPortrait;
|
||||
//NSNumber *numb=[NSNumber numberWithInteger:UIDeviceOrientationPortrait];
|
||||
//[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
|
||||
// withObject:numb];
|
||||
|
||||
Reference in New Issue
Block a user