Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I starred this question hoping someone would give you an insightful response and I'd learn something.. sadly I'm afraid that you might need to use transforms to get this to work properly. Here's the code I've been using lately to solve the problem:</p> <pre><code>- (void)forceLandscapeForView:(UIView *)theView { theView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); theView.bounds = CGRectMake(0, 0, 480, 320); theView.center = CGPointMake(160, 240); [theView setNeedsLayout]; [theView setNeedsDisplay]; } </code></pre> <p>Then when you're adding your new view, check the current orientation and if necessary force the rotation:</p> <pre><code>if (!UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) { [self forceLandscapeForView:_activeViewController.view]; } </code></pre> <p>Then of course you'll want to respond appropriately to <code>shouldAutorotateToInterfaceOrientation</code> in each of your view controllers:</p> <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscape(interfaceOrientation); } </code></pre> <p>I would love to hear about alternate solutions if this isn't all necessary. There is also one caveat I've noticed with this setup: if you have a transition between views, and you rotate the phone during that transition, it's possible for the views orientations to get flipped or "stuck" on the wrong landscape orientation, such that you need to turn the phone over (landscape-right vs landscape-left) as you navigate between views.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload