Log in or register to post comments

UIViewController Rotation

May 31, 2012 - 9:55am #1

Dear All,

I used "UIViewController" to display a video on it based on the marker so i created:
ActionViewController.h
ActionViewController.m
ActionViewController.xib

and every thing working well but i need to autorotate it based on Iphone Orientation
so i used this method in ActionViewController.m

-----------------------------------------------
-(BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation {

return YES && (interfaceOrientation ==UIInterfaceOrientationLandscapeRight);
}
-----------------------------------------------

but it doesn't work, although when i close the video the debugger write "ARParent: Rotating to Landscape Right"

What can i do?

Re: UIViewController Rotation

June 9, 2012 - 12:01pm #4

Please forgive me im very new to all this. May I inquire as to how you were able make an appcontroller in Xcode that I can use with storyboarding? I would like to put an interface over the existing AR content. Currently I have a fairly robust app I would simply like to show the AR view on demand and hide it when an interface element has been touched...

Re: UIViewController Rotation

June 3, 2012 - 2:58am #3

I Tried it but it still doesn't work
It is rotate only when i close the view, but i need to rotate it in iPhone rotation event
How can catch the rotation function (event)?

Re: UIViewController Rotation

June 1, 2012 - 9:04pm #2

Hello Khaled1989
This is what I'm using, I've got mine setup to work only on landscape mode, but you can comment and uncomment whatever fits your needs:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Support all orientations
//return YES;

// Support both portrait orientations
//return (UIInterfaceOrientationPortrait == interfaceOrientation ||
// UIInterfaceOrientationPortraitUpsideDown == interfaceOrientation);

// Support both landscape orientations
return (UIInterfaceOrientationLandscapeLeft == interfaceOrientation ||
UIInterfaceOrientationLandscapeRight == interfaceOrientation);
}

Best
Juan

Log in or register to post comments