Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I stop a modal view from disappearing when rotating on iPad?
    primarykey
    data
    text
    <p>I'm using <code>willRotateToInterfaceOrientation</code> to swap views when my iPad rotates. If I have a modal view or an alert view open when my device rotates and swaps views, the view swaps and the alert disappears and does not reappear, even if the alert is "presented" again later. </p> <p><strong>Edit:</strong> I've narrowed this problem a bit. When a modal view is presented with <code>UIModalPresentationFullScreen</code>, the modal view "survives" rotations.</p> <p>What can I do to fix this?</p> <p><strong>Here is my implementation of <code>willRotateToInterfaceOrientation</code>:</strong></p> <pre><code>- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; // // Load an alternate view depending on the orientation // if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) { [UIView beginAnimations:@"" context:nil]; [self setView:theLandscapeView]; self.view.bounds = CGRectMake(0, 0, 1024, 768); self.view.transform = CGAffineTransformMakeRotation(kDegreesToRadians * (-90)); [UIView commitAnimations]; }else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { [UIView beginAnimations:@"" context:nil]; [self setView:theLandscapeView]; self.view.bounds = CGRectMake(0, 0, 1024, 768); self.view.transform = CGAffineTransformMakeRotation(kDegreesToRadians * (90)); [UIView commitAnimations]; }else if (toInterfaceOrientation == UIInterfaceOrientationPortrait) { [UIView beginAnimations:@"" context:nil]; [self setView:thePortraitView]; self.view.transform = CGAffineTransformMakeRotation(kDegreesToRadians * (0)); self.view.bounds = CGRectMake(0, 0, 768, 1024); [UIView commitAnimations]; }else if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { [UIView beginAnimations:@"" context:nil]; [self setView:thePortraitView]; self.view.transform = CGAffineTransformMakeRotation(kDegreesToRadians * (180)); self.view.bounds = CGRectMake(0, 0, 768, 1024); [UIView commitAnimations]; } } </code></pre>
    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.
 

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