Skip to content

Commit

Permalink
shouldAutorotateToInterfaceOrientation now takes modalViewControllers…
Browse files Browse the repository at this point in the history
… into consideration.

Fixes ViewDeck#28.
  • Loading branch information
Inferis committed Feb 2, 2012
1 parent 4e83878 commit 69294da
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions ViewDeck/IIViewDeckController.m
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,27 @@ - (void)viewDidDisappear:(BOOL)animated {
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
_preRotationWidth = self.referenceBounds.size.width;

if (self.rotationBehavior == IIViewDeckRotationKeepsViewSizes) {
_leftWidth = self.leftController.view.frame.size.width;
_rightWidth = self.rightController.view.frame.size.width;
}

if (self.centerController) {
// let the center controller handle the rotation behavior
BOOL should = [self.centerController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
return should;
}

return YES;
// heads up to @schemers for accounting with the modal views.
// see: https://github.com/Inferis/ViewDeck/issues/28

// let the viewdeckcontroller modalViewController handle the rotation behavior
UIViewController* rotateController = self.modalViewController;
// or, let the center controller modalViewController handle the rotation behavior
if (!rotateController) rotateController = self.centerController.modalViewController;
// or, let the center controller handle the rotation behavior
if (!rotateController) rotateController = self.centerController;

BOOL should = YES;
if (rotateController)
should = [rotateController shouldAutorotateToInterfaceOrientation:interfaceOrientation];

return should;
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
Expand Down

0 comments on commit 69294da

Please sign in to comment.