openFrameworks
openFrameworks copied to clipboard
Can't disable rotation on iOS 10.1
I can't disable the rotation on my iPad Pro with iOS 10.1 and Xcode 8.1 and the current GitHub master version of OF. I tried using enableHardwareOrientation = false and enableHardwareOrientationAnimation = false and also tried manually setting the orientation with ofSetOrientation(). It also seems to be broken in the simulator.
ping @danoli3 @julapy
I'll check this out... Always had issues with the orientation code, more the backwards to iOS 5.0 compatibility, but since we are no 7+ should be a breeze to strip out anything that could be breaking it / implement iOS 10 overload.
This always seems to interfere if I have an existing app orientation - I just comment it out
https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxiOS/src/core/ofxiOSViewController.mm#L28
@jvcleave thanks for the suggestion. unfortunately, commenting that out doesn't seem to change the behavior for the better for me.. the orientation still changes when i rotate the iPad.
edit: something else that's weird: when i start the app with the iPad physically rotated (not in default orientation) then the values returned by ofGetWidth() and ofGetHeight() are flipped. when i physically rotate the iPad to upright, and then rotate it back to where it was, then the values are correct again. is this normal behavior, or is there some workaround? or does everyone just use their mobile devices in default orientation? :)
ok actually it's more complicated... it's more like the viewport doesn't have the right size. looks like it might be related to this unsolved issue from three years ago https://forum.openframeworks.cc/t/orientation-is-not-updated-on-start-up/14998/4 and maybe this one too? https://forum.openframeworks.cc/t/ios-8-of-not-setting-orientation-properly/16729/23
my solution for now is to enable hardware orientation, and to remove all the unwanted orientations from my plist as mentioned in that first forum link, and call ofSetOrientation() at the top of setup(). there's a little rotation animation on startup that i wish i could get rid of, but otherwise it works.
as i understand it, this means an OF app cannot currently support multiple orientations on iOS.
@kylemcdonald see if ofGetScreenWidth/Height gives you better values
I've been working with iOS/OF quite a bit in the last year or so and I often have to do a lot of tweaks per project in order to get it to work. I'll love to do a push that gets it up to date with ARC/Better compatibility with AutoLayout, remove deprecated calls
Is this issue still relevant? I think it is working now and can be closed.
ping @ofTheo