@@ -541,6 +541,44 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
541541 }
542542
543543 strnew += lines[i].replace (" $interface_orientations" , orientations);
544+ } else if (lines[i].contains (" $ipad_interface_orientations" )) {
545+ String orientations;
546+ const DisplayServer::ScreenOrientation screen_orientation =
547+ DisplayServer::ScreenOrientation (int (GLOBAL_GET (" display/window/handheld/orientation" )));
548+
549+ switch (screen_orientation) {
550+ case DisplayServer::SCREEN_LANDSCAPE:
551+ orientations += " <string>UIInterfaceOrientationLandscapeRight</string>\n " ;
552+ break ;
553+ case DisplayServer::SCREEN_PORTRAIT:
554+ orientations += " <string>UIInterfaceOrientationPortrait</string>\n " ;
555+ break ;
556+ case DisplayServer::SCREEN_REVERSE_LANDSCAPE:
557+ orientations += " <string>UIInterfaceOrientationLandscapeLeft</string>\n " ;
558+ break ;
559+ case DisplayServer::SCREEN_REVERSE_PORTRAIT:
560+ orientations += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n " ;
561+ break ;
562+ case DisplayServer::SCREEN_SENSOR_LANDSCAPE:
563+ // Allow both landscape orientations depending on sensor direction.
564+ orientations += " <string>UIInterfaceOrientationLandscapeLeft</string>\n " ;
565+ orientations += " <string>UIInterfaceOrientationLandscapeRight</string>\n " ;
566+ break ;
567+ case DisplayServer::SCREEN_SENSOR_PORTRAIT:
568+ // Allow both portrait orientations depending on sensor direction.
569+ orientations += " <string>UIInterfaceOrientationPortrait</string>\n " ;
570+ orientations += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n " ;
571+ break ;
572+ case DisplayServer::SCREEN_SENSOR:
573+ // Allow all screen orientations depending on sensor direction.
574+ orientations += " <string>UIInterfaceOrientationLandscapeLeft</string>\n " ;
575+ orientations += " <string>UIInterfaceOrientationLandscapeRight</string>\n " ;
576+ orientations += " <string>UIInterfaceOrientationPortrait</string>\n " ;
577+ orientations += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n " ;
578+ break ;
579+ }
580+
581+ strnew += lines[i].replace (" $ipad_interface_orientations" , orientations);
544582 } else if (lines[i].contains (" $camera_usage_description" )) {
545583 String description = p_preset->get (" privacy/camera_usage_description" );
546584 strnew += lines[i].replace (" $camera_usage_description" , description) + " \n " ;
0 commit comments