I'm having a bizarre problem here with iOS8. I've been googling and bashing my head against a wall for a couple of days with no luck. I'm not exactly sure how to even explain it, but here goes...
Apps have been running fine under iOS7, but now compiling using xCode 6/iOS8 I'm having a few strange orientation problems. I'm not using a xib file, but instead creating a window and view programatically. I'm running OpenGL in the view, and then handling everything else inside OpenGL. So, I'm collecting touches and passing them to my GL routines. All has been fine forever, til now.
Now with iOS8 it seems as if the "touch window" is rotating itself so that touches in Landscape are limited to one side of the screen, as if the display window is Landscape, but the touches are all within a Portrait window that is set to on one side of the screen.
What seems bizarre is that touches come through to the view all over the screen as normal, but the Y value stops at 320 and goes no further. The X acts normally. If I turn the device to Portrait (the view controller does not auto rotate), it all works, but in Landscape it switches to this strange behaviour.
I've tried all I can think of without any changes, and am not sure where to begin to work out why this could be happening. Any advice would be greatly appreciated.
On iOS8, UIScreen is now interface oriented. In some (or should I say all of) libraries before iOS8, some checks were done to adjust that lack and swap width and height when the application was in landscape.
You should look at some code that makes some rotation and remove it.
-[UIScreen bounds]
,-[UIScreen applicationFrame]
,
Status bar frame and
Keyboard frame are now interface-oriented.
(cf. WWDC2014 video - view controller advancements in iOS8 @ 50:41)
In our case.
Force to rotate with view's transform caused that problem.
We removed that code, rotate with
+ (void)attemptRotationToDeviceOrientation
and problem solved.
We called that method at our forceRotate method.
-(void)forceRotateLandscape {
...
UIViewController *vc = [UIViewController new];
[topVc presentViewController:vc animated:NO completion:nil];
[topVc dismissViewControllerAnimated:NO completion:nil];
supportedOrientations = UIInterfaceOrientationMaskLandscapeRight;
[UIViewController attemptRotationToDeviceOrientation];
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With