hi guys, so I sat again down to figure out how to make the auto-rotation work on ios6+0073 and I used the “iosNativeExample”
so… long story short it works… but you need to tweak OF ofxiPhoneViewController obj-c class inside ofxIphone
in general here is how you fix the rotation problem in ios6 & OF:
you find the deprecated function
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
in your obj-c code
and you paste bellow it :
-(BOOL)shouldAutorotate
{
return [[self.navigationController navigationController] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.navigationController navigationController] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.navigationController navigationController] preferredInterfaceOrientationForPresentation];
}
you must do this for every ofxiPhoneViewController you have or every UIViewController
if you want them to respond to the rotation you should paste the above code below the deprecated function
* you can leave the function there to support ios5 (I am not sure if this is going to need a precompiler if statement you need to test it on ios5 but It works on ios6 so…)
and yeah that’s it.
also in case you have problems like not compiling or not rotating
GO:
inside your app delegate (your ofxiPhoneAppDelegate interface)
inside the .mm file
inside the - (BOOL)application:
AND:
you MAKE SURE
your viewController is a root controller
like this:
[self.window setRootViewController:self.navigationController];
or this:
self.window.rootViewController = self.navigationController;
Below I attached the example but to solve the cropping problem you need to modify stuff inside the
ofxiPhoneViewController object (@interface) in the ofxIphone core
So go inside openframeworks > ios+OFLib.xcodeprj > addons >ofxiPhone > src > core > ofxiPhoneViewController.mm
inside the
- (id)initWithFrame:(CGRect)frame app:(ofxiPhoneApp *)app {
if((self = [super init])) {
ADD: after the self.glView.delegate=self;
self.glView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
this solves the problem but you need to modify it on your own OF
iosNativeExample.zip