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
This is hard to visualise:
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
Could you possibly post up some pictures to show what is happening?
thanks
N