From c5c9cb21199fb0e028f0b15a11f5a2edb6ea3ebe Mon Sep 17 00:00:00 2001 From: hborders Date: Wed, 18 Jul 2012 10:46:27 -0500 Subject: [PATCH] Auto-rotate only when both master and detail want to. Changed shouldAutorotateToInterfaceOrientation: to match the behavior of UISplitViewController where we don't autorotate unless all views support it. --- Classes/MGSplitViewController.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Classes/MGSplitViewController.m b/Classes/MGSplitViewController.m index 61b30a6..320ce7c 100644 --- a/Classes/MGSplitViewController.m +++ b/Classes/MGSplitViewController.m @@ -165,7 +165,15 @@ - (void)dealloc - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; + if (self.masterViewController && self.detailViewController) { + return [self.masterViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation] && [self.detailViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + } else if (self.masterViewController) { + return [self.masterViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + } else if (self.detailViewController) { + return [self.detailViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + } else { + return YES; + } }