I have two view controllers, A and B. A is designed to support only Portrait, while B can support landscape. I show B using containment api.
[self addChildViewController:child]; [self.view addSubview:child.view]; child.view.frame = self.view.bounds; [child didMoveToParentViewController:self];
I implemented
- (BOOL)shouldAutorotate { UIViewController *current = _presentingChild ? _child : self; return [current shouldAutorotate]; } - (NSUInteger)supportedInterfaceOrientations { UIViewController *current = _presentingChild ? _child : self; return [current supportedInterfaceOrientations]; }
everything works like a charm. If the devices are landscape and A and I represent B, the rotation immediately turns.
the problem occurs when I fire B. If the device has landscape A, the landscape is displayed (and this should not be).
Do you have any suggestion on how to deal with this problem? I know that I can use a modal controller, and this will solve the problem. But I do not want to use modal vc for this particular situation.
Luka source share