Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Update ViewDeck/IIViewDeckController.m #143

Closed
wants to merge 1 commit into from

5 participants

@brianmichel

Added support for new autorotation methods. If we have a center controller, let it decide, otherwise use the standard idioms for either platform.

@brianmichel brianmichel Update ViewDeck/IIViewDeckController.m
Added support for new autorotation methods. If we have a center controller, let it decide, otherwise use the standard idioms for either platform.
6d8b333
@Inferis
Owner

Why not call super?

You're right, the return at the end should just call super.

@ant512

You're missing a definition for shouldRotate that handles recalculating the left and right controller sizes:

#ifdef __IPHONE_6_0

  • (BOOL)shouldAutorotate {

    _preRotationWidth = self.referenceBounds.size.width;
    _preRotationCenterWidth = self.centerView.bounds.size.width;

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

    return YES;
    }

  • (NSUInteger)supportedInterfaceOrientations {
    if (self.centerController) return [self.centerController supportedInterfaceOrientations];
    return [super supportedInterfaceOrientations];
    }

#endif

@svachalek
@Inferis
Owner

You should use the new version (2.0) currently on the develop branch for ios6. It has a modified api so you need some changes to your code, but it's much better for rotation.

@fsosa

Is there anything left to do on 2.0 until it becomes master?

@Inferis
Owner
@Inferis
Owner

No longer applicable.

@Inferis Inferis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 14, 2012
  1. @brianmichel

    Update ViewDeck/IIViewDeckController.m

    brianmichel authored
    Added support for new autorotation methods. If we have a center controller, let it decide, otherwise use the standard idioms for either platform.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 ViewDeck/IIViewDeckController.m
View
9 ViewDeck/IIViewDeckController.m
@@ -638,6 +638,15 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
return should;
}
+#ifdef __IPHONE_6_0
+- (NSUInteger)supportedInterfaceOrientations {
+ if (self.centerController) {
+ return [self.centerController supportedInterfaceOrientations];
+ }
+ return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskAllButUpsideDown;
+}
+#endif
+
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
Something went wrong with that request. Please try again.