So far, so good.
In my context, I believe the simpler is the best solution. I then dropped my two-vc architecture coupled with a vc with an embed view in favor to one vc with one view.
The point is that you need to write code to handle the UI differences In my case, I also had to changed the way the hierarchy of the views in the vc in order to be able to disable some of them at runtime. Also, I had to enlarge a view for the horizontal mode, and I use the scale transformation of the layer. The bad point is that it actually zoom in at graphics level. The texts are not as slick as if you increase the font size. This is something I will do very soon to preserve the best quality possible.
The code I wrote so far in the device rotation selector as follows:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
static CGRect actionViewRect = (CGRect){0,0,0,0};
if (!actionViewRect.size.height) actionViewRect = self.actionView.frame;
//self.containerView.hidden = YES;
[UIView transitionWithView:self.view
duration:0.3f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
// From portrait to landscape
if (UIInterfaceOrientationIsPortrait(fromInterfaceOrientation)) {
self.navigationController.navigationBar.hidden = YES;
self.tabBarController.tabBar.hidden = YES;
self.statusBar.hidden = NO;
self.actionView.hidden = YES;
self.containerViewTopToSuperView.constant = self.navigationController.navigationBar.frame.origin.y;
self.containerViewBottomToSuperView.constant = 0;
CGRect rect = actionViewRect;
rect.origin.y = actionViewRect.origin.y+actionViewRect.size.height;
rect.size.height = 0;
self.actionView.frame = rect;
// -- location view (bigger)
CGFloat
s = 1.5;
self.locationView.layer.transform = CATransform3DMakeScale(s, s, 1);
// -- HUD view (bigger)
s = 1.5;
self.hudLeft.layer.transform = CATransform3DMakeScale(s, s, 1);
}
// From landscape to portrait
else {
self.navigationController.navigationBar.hidden = NO;
self.tabBarController.tabBar.hidden = NO;
self.locationView.layer.transform = CATransform3DIdentity;
self.actionView.hidden = NO;
self.actionView.frame = actionViewRect;
self.containerViewTopToSuperView.constant = self.navigationController.navigationBar.frame.origin.y
+ self.navigationController.navigationBar.frame.size.height;
self.containerViewBottomToSuperView.constant = self.tabBarController.tabBar.frame.size.height;
// -- location view (standard)
self.hudLeft.layer.transform = CATransform3DIdentity; }
// -- HUD view (bigger)
self.hudLeft.frame = (CGRect){.origin=(CGPoint){0,0}, .size=self.hudLeft.frame.size};
}
completion:^(BOOL finished) {
// Direct video to the destination, current controller
AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication] delegate];
app.previewLayer.orientation = [[UIDevice currentDevice] orientation];
//self.containerView.hidden = NO;
//[UIView setAnimationsEnabled:YES];
}
];
}