Log in or register to post comments

Stuck in Portrait until device is physically rotated

July 9, 2013 - 9:54am #1

I'm building an app using the ImageTarget native iOS sample app as the base code.  I've set the orientation for both iOS5 and iOS6 to support only landscape, and the display rotates correctly in both iOS5 and iOS6.  I'm programmatically creating UIKit UI objects in the OverlayView without a problem.  

In fact, the entire app is running as expected, with the exception of touch events when the app is first launched.

Upon first launching the app on an iPad, holding the app in either landscape orientation, touch events only occur as if the device was in Portrait orientation.  Any touches in the range beyond the Portrait width are ignored until I physically rotate the device into the opposite landscape orientation.  At this point, touch events occur as would be expected in landscape, and continue to occur correctly even after I rotate the device back to the original orientation.

This behaviour occurs regardless of the starting Landscape orientation, either left or right, when the app is first launched.

"handleARViewRotation:(UIInterfaceOrientation)interfaceOrientation" in ARViewController.mm is called on launch with the correct landscape orientation.

Have I missed a spot in the code where the launch orientation has been defined to Portrait?

Thanks for your help,

Jorge

Stuck in Portrait until device is physically rotated

July 11, 2013 - 2:54am #5

Not really sure what to suggest here.

Just wondered whether you have experimented with bringing up Game Center from ARParentViewController instead?

N

Stuck in Portrait until device is physically rotated

July 10, 2013 - 4:13pm #4

Thank you for the response, NalinS.  Yes, even though I set the supported orientations in the plist, the problem occured until I applied the fix.

But now I've encountered a new problem that is iOS5 specific, related to Game Center.

When I display the Game Center Leaderboard ViewController using the OverlayViewController in iOS 6 it appears fine.  The orientation remains Landscape, and the Game Center Leaderboard scrolls onto the screen from the bottom as expected.  All is good.

However, when I display it in iOS 5 using the OverlayViewController, badness occurs.

The Game Center Leaderboard OverlayViewController disappears, and the Game Center view appears as if the orientation was in Portrait orientation (which it is not).  All is bad.

I have tried forcing the orientation to landscape, which has worked in other applications I have written.

 

    if ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"5."])

        [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeRight animated:NO];

 
Physically rotating the device does not resolve the problem, as it did previously.

Has anyone successfully displayed the Game Center Leaderboard ViewController in iOS 5 using the ImageTargets codebase? 

Again, thanks for your help,

Jorge

Stuck in Portrait until device is physically rotated

July 10, 2013 - 2:24am #3

Good to hear you solved the problem.

Orientation support changed in iOS6, and i think it is defined in the plist for the project - you should be able to set the initial orientation by selecting it after selecting the target.

It might also be worth searching the forums for orientation as this may have come up before.

 

N

Stuck in Portrait until device is physically rotated

July 9, 2013 - 11:51am #2

I have fixed the problem with what seems to me to be a hack.

I added the following two lines of code to "viewDidAppear:(BOOL)animated" in ARParentViewController.mm.

 

    [arViewController handleARViewRotation:self.interfaceOrientation];

    [overlayViewController handleViewRotation:self.interfaceOrientation];

 
These lines are executed in "viewWillAppear", but calling the methods during "viewDidAppear" addresses my original problem of ignored touch events upon launch of the app.
 
I have not investigated further to determine what happens between the two calls.
 
Hope this helps anyone else who encounters a similar problem.
 
Jorge
Log in or register to post comments