Orientation defaults to Portrait

Is Portrait orientation forced somewhere? I believe I have everything where it needs to be and it’s functional but when I’m in my app and launch my menu it either defaults to portrait or opens where I last left it. If I shake the device, it will correct itself. This tells me my viewcontrollers are setup right but, perhaps I need to add something to testapp.mm or possibly the delegate or ofappiphonewindow file…?

I’ve searched and see a lot of areas I could manipulate and have tried but to no change. Any ideas?

I do have my XIBs, plist, and viewcontrollers setup to rotate.

EDIT - Digging into the alerts file…

Assuming you’re working in 0062 (orientation has changed in 007)…

To properly respond to orientation events, first make sure you make the changes here so that upside-down is displayed properly:


Then in your main app’s setup(), call ofxiPhoneAlerts.addListener(this) and make sure your main app has something like:

void mainApp::deviceOrientationChanged(int newOrientation){  
	if ( ( newOrientation == OFXIPHONE_ORIENTATION_PORTRAIT ) || ( newOrientation == OFXIPHONE_ORIENTATION_UPSIDEDOWN ) )  
		ofxiPhoneSetOrientation( (UIDeviceOrientation)newOrientation );  

In my example I’m forcing the view to always be vertical.

This stuff is for oF only, you may have to handle things yourself if you’re making use of UIKit.

Thank you! I tried something very similar earlier and while it’s better a new issue surfaces. Now my app window rotates too. Is there a solution for this?