File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,33 @@ namespace Fuse.Platform
506506 }
507507 }
508508 }
509+ #if defined ( __IPHONE_16_0 ) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_16_0
510+ if ( @available ( iOS 16 .0 , * ) ) {
511+ for ( UIScene * scene in UIApplication . sharedApplication . connectedScenes ) {
512+ if ( ! [ scene isKindOfClass: [ UIWindowScene class] ] ) {
513+ continue ;
514+ }
515+ UIWindowScene * windowScene = ( UIWindowScene * ) scene ;
516+ UIInterfaceOrientationMask currentInterfaceOrientation = 1 << windowScene . interfaceOrientation ;
517+ if ( ! ( @{ supportedOrientation : Get( ) } & currentInterfaceOrientation ) ) {
518+ [ [ [ windowScene keyWindow ] rootViewController ] setNeedsUpdateOfSupportedInterfaceOrientations ] ;
519+ UIWindowSceneGeometryPreferencesIOS* preference =
520+ [ [ UIWindowSceneGeometryPreferencesIOS alloc ] initWithInterfaceOrientations: @{ supportedOrientation: Get( ) } ] ;
521+ [ windowScene requestGeometryUpdateWithPreferences : preference
522+ errorHandler: ^ ( NSError * error ) {
523+ NSLog ( @"Failed to change device orientation: %@" , error ) ;
524+ } ] ;
525+ }
526+ }
527+ }
528+ else
529+ {
530+ [ [ UIDevice currentDevice ] setValue: value forKey : @"orientation" ] ;
531+ }
532+ #else
509533 [ [ UIDevice currentDevice ] setValue: value forKey : @"orientation" ] ;
534+ #endif
535+
510536 @}
511537 }
512538}
You can’t perform that action at this time.
0 commit comments