Hi, not sure if this is an OF0.8 bug or whether it’s my bug…
In the start of my app’s setup method I do this:
ofSetOrientation(OF_ORIENTATION_90_RIGHT);
just to get a reference orientation which I base all my drawing coordinates on.
Then the only time I adjust the orientation from the app is here:
void myApp::deviceOrientationChanged(int newOrientation){
if (newOrientation == OF_ORIENTATION_90_LEFT || newOrientation == OF_ORIENTATION_90_RIGHT) {
DLog();
ofSetOrientation((ofOrientation)newOrientation);
…
Now the problem is that when starting up it’s always in OF_ORIENTATION_90_RIGHT, even though I want it to be the same as the iOS orientation (either OF_ORIENTATION_90_LEFT or OF_ORIENTATION_90_RIGHT). That deviceOrientationChanged is not called and in the OF code I see that…
ofxiOSAlerts.deviceOrientationChanged(interfaceOrientation);
…is also not called.
So, to force an update, I tried editing this…
- (void)receivedRotate:(NSNotification*)notification {
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
ofLogVerbose("ofxiOSAppDelegate") << "device orientation changed to " << interfaceOrientation;
if(interfaceOrientation != UIDeviceOrientationUnknown && [self.glViewController isReadyToRotate] ) {
ofxiOSAlerts.deviceOrientationChanged(interfaceOrientation);
}
}
…to this…
- (void)receivedRotate:(NSNotification*)notification {
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
ofLogVerbose("ofxiOSAppDelegate") << "device orientation changed to " << interfaceOrientation;
ofxiOSAlerts.deviceOrientationChanged(interfaceOrientation);
}
And now it always seems to find the correct orientation on start-up, but am worried about any side-effects as that if-statement was clearly there for a purpose…
Any ideas?