Browse Source

updateKeyboard should use the SDL window's screen instead of the view window's screen, which may be nil.

Fixes https://github.com/libsdl-org/SDL/issues/8200

(cherry picked from commit 3a9a52fe6c40aee8d174bb756b4a339d35386633)
Sam Lantinga 1 year ago
parent
commit
f892ae10d6
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/video/uikit/SDL_uikitviewcontroller.m

+ 3 - 1
src/video/uikit/SDL_uikitviewcontroller.m

@@ -502,9 +502,11 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o
 
 - (void)updateKeyboard
 {
+    SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata;
+
     CGAffineTransform t = self.view.transform;
     CGPoint offset = CGPointMake(0.0, 0.0);
-    CGRect frame = UIKit_ComputeViewFrame(window, self.view.window.screen);
+    CGRect frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen);
 
     if (self.keyboardHeight) {
         int rectbottom = self.textInputRect.y + self.textInputRect.h;