Hi,
I have some GUI of my own inside CROverlayViewController and one starting screen inside CRParentViewController. What is the proper way, to place GUI elements depending on device rotation? Now I have that starting CloudReco sample using push segue (storyboard in use), whatever is orientation in app menu, CloudReco itself is starting with the same as menu and GUI looks good (corner images are in fact in corners). However GUI looks good before rotation, after it's a mess. If you change from portrait to landscape inside CloudReco part all elements that were below certain height will not be shown after rotation to landscape...
Only rotation code of CRParentViewController is called:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ // Since CRParentViewController does not inherit from BaseViewController, // we have to override this behavior BOOL retVal = [[CRQCARutils getInstance] shouldAutorotateToInterfaceOrientation:toInterfaceOrientation]; return retVal; // return YES; } -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ NSLog(@"CRPVC: didRotateFromInterfaceOrientation"); [UIView animateWithDuration:0.5 animations:^{ [startView setCenter:self.view.center]; }]; }
but CROverlayViewController not:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ NSLog(@"CROVC: shouldAutorotate"); // Since CRParentViewController does not inherit from BaseViewController, // we have to override this behavior BOOL retVal = [[CRQCARutils getInstance] shouldAutorotateToInterfaceOrientation:toInterfaceOrientation]; return retVal; // return YES; }
What's more, animating startView makes it move from ealier center to the newer one. I wish I could make all elements stay on their place.
Here are logs from rotations: (VC stands for ViewController ;) )
2013-04-04 14:49:51.593 CloudReco[1046:707] OVC: handleViewRotation 2013-04-04 14:49:51.595 CloudReco[1046:707] CRVC: handleARViewRotation 2013-04-04 14:49:51.597 CloudReco[1046:707] CRVC: Rotating to Landscape Left 2013-04-04 14:49:51.600 CloudReco[1046:707] EAGLView: layoutSubviews 2013-04-04 14:49:51.604 CloudReco[1046:707] EAGLView: initRendering 2013-04-04 14:49:51.913 CloudReco[1046:707] CRPVC: didRotateFromInterfaceOrientation
How to properly deal with rotations?
This is hard to visualise:
How to properly deal with rotations?
Here you go,
http://speedy.sh/UHJSV/IMG-1007.PNG
http://speedy.sh/jgeYE/vuforia-landscape.PNG
http://speedy.sh/bjXaM/vuforia-portrait.PNG
How to properly deal with rotations?
Btw, the UILabel with pointing device hint I have added to CRParentViewController (because tapped it should start Vuforia) and rest has been added in CROverlayViewController.
How to properly deal with rotations?
Any chance you can attach these files here using the new "attach" functionality on posts?
N
How to properly deal with rotations?
seemed lot faster and easier, didn't you take a look a those links?
How to properly deal with rotations?
It is preferrable to use the in-built mechanism, rather than third party hosting services because sometime it is not clear whether you need to wait etc.
How to properly deal with rotations?
Thanks a lot, looks good :) where did you get this storyboard version ? do you have it to check segues and stuff? Maybe my fault is in connections, anyway love to see this "pro storyboard" CloudReco :)
p.s. I'll use next time "attach" ;)
How to properly deal with rotations?
This is something I cooked up in order to help answer questions like this :)
How to properly deal with rotations?
Didn't work :/ this part was faulty: _cameraViewController.arViewSize = self.view.
How to properly deal with rotations?
You need to add this to CRParentViewController.h