src/video/uikit/SDL_uikitview.m
changeset 9551 950a1a7b4c3c
parent 9532 318042c16b76
child 9619 b94b6d0bff0f
     1.1 --- a/src/video/uikit/SDL_uikitview.m	Sat Apr 11 20:43:11 2015 +0200
     1.2 +++ b/src/video/uikit/SDL_uikitview.m	Fri Apr 10 23:30:31 2015 -0300
     1.3 @@ -77,11 +77,8 @@
     1.4  
     1.5          data.viewcontroller.view = view;
     1.6  
     1.7 -        if (data.uiwindow.rootViewController != data.viewcontroller) {
     1.8 -            data.uiwindow.rootViewController = data.viewcontroller;
     1.9 -        } else if (view) {
    1.10 -            [data.uiwindow addSubview:view];
    1.11 -        }
    1.12 +        data.uiwindow.rootViewController = nil;
    1.13 +        data.uiwindow.rootViewController = data.viewcontroller;
    1.14  
    1.15          [data.uiwindow layoutIfNeeded];
    1.16      }
    1.17 @@ -96,13 +93,13 @@
    1.18          [data.viewcontroller.view removeFromSuperview];
    1.19          data.viewcontroller.view = self;
    1.20  
    1.21 -        if (data.uiwindow.rootViewController != data.viewcontroller) {
    1.22 -            /* The root view controller handles rotation and the status bar.
    1.23 -             * Assigning it also adds the controller's view to the window. */
    1.24 -            data.uiwindow.rootViewController = data.viewcontroller;
    1.25 -        } else {
    1.26 -            [data.uiwindow addSubview:self];
    1.27 -        }
    1.28 +        /* The root view controller handles rotation and the status bar.
    1.29 +         * Assigning it also adds the controller's view to the window. We
    1.30 +         * explicitly re-set it to make sure the view is properly attached to
    1.31 +         * the window. Just adding the sub-view if the root view controller is
    1.32 +         * already correct causes orientation issues on iOS 7 and below. */
    1.33 +        data.uiwindow.rootViewController = nil;
    1.34 +        data.uiwindow.rootViewController = data.viewcontroller;
    1.35  
    1.36          /* The view's bounds may not be correct until the next event cycle. That
    1.37           * might happen after the current dimensions are queried, so we force a