# SDL: Fixed view frame from flipping back and forth between landscape and portrait on iOS (a3a45)

**URL:** <https://discourse.libsdl.org/t/sdl-fixed-view-frame-from-flipping-back-and-forth-between-landscape-and-portrait-on-ios-a3a45/42729>\
**Category:** SDL Commits\
**Created:** [February 23, 2023, 8:00pm UTC](https://discourse.libsdl.org/t/sdl-fixed-view-frame-from-flipping-back-and-forth-between-landscape-and-portrait-on-ios-a3a45/42729 "2023-02-23T20:00:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 23, 2023, 8:00pm UTC](https://discourse.libsdl.org/t/sdl-fixed-view-frame-from-flipping-back-and-forth-between-landscape-and-portrait-on-ios-a3a45/42729/1 "2023-02-23T20:00:21Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/a3a45f670907087c794f1f1ee075d3c0dedfe4d0>
>
> (cherry picked from commit b2d913883c39e0a53e55eb9286d7e442d565554e)

```diff
From a3a45f670907087c794f1f1ee075d3c0dedfe4d0 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 23 Feb 2023 09:14:53 -0800
Subject: [PATCH] Fixed view frame from flipping back and forth between
 landscape and portrait on iOS

(cherry picked from commit b2d913883c39e0a53e55eb9286d7e442d565554e)
---
 src/video/uikit/SDL_uikitvideo.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m
index 64cff193b6c1..b52d84e83daa 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -220,7 +220,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
      * https://bugzilla.libsdl.org/show_bug.cgi?id=3465
      * https://forums.developer.apple.com/thread/65337 */
     UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation;
- BOOL landscape = UIInterfaceOrientationIsLandscape(orient);
+ BOOL landscape = UIInterfaceOrientationIsLandscape(orient) ||
+ !(UIKit_GetSupportedOrientations(window) & (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown));
     BOOL fullscreen = CGRectEqualToRect(screen.bounds, frame);
 
     /* The orientation flip doesn't make sense when the window is smaller

```
