I want to design a view/view controler that automaticaly shows/hides a subview when in landscape orientation. I want the subview to dissapear completely and other subviews to take up its space.
Using a UIViewController, I wrote code that sets the subviews' frame property and call it on:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration;
This solves the problem most of the times but has problems when the orientation change is happening when the view is not appearing. to bypass this, I am also calling the resizing method on:
- (void)viewWillAppear:(BOOL)animated;
but this has problems in some rare cases (involving a UISearchDisplayController) so I am also calling the resizing method on
- (void)viewDidAppear:(BOOL)animated;
As you can understand, I am unhappy with this code and I am looking for a better/more performant way to do this.
Any ideas?