Denis Voloshin
Denis Voloshin

Reputation: 798

modal view controller takes full page on rotate

My app needs to open two modal view controllers one after another (I have login view and if the input is wrong the error message is shown in the second modal view controller. It works as expected but I encountered a problem when a device is rotated, for some unknown reason the first modal view controller takes the full page and the most of screen turns to be white.

The code I use to open the modal UIViewController as following

        LogonController * logonControler =[[self storyboard] instantiateViewControllerWithIdentifier:@"LogonController"];

        logonControler.modalPresentationStyle = UIModalPresentationFormSheet;
        logonControler.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

        [self  presentModalViewController:self.logonController animated:YES];

        logonControler.view.superview.backgroundColor=[UIColor clearColor];
        logonControler.view.superview.frame = CGRectMake(0, 0, 400, 200);

        CGPoint center = [DesktopSplitViewController sharedInstance].view.center;

        if (![UIApplication isPortrait]) {
            center=CGPointMake(center.y, center.x);
        }
        center.y=center.y-100;

        logonControler.view.superview.center = center;

the second modal view controller is open in the same manner from the logonControler just using different UIViewController implementation.

I'm stuck with this more then two days any thoughts will be appreciated.

I found exactly the same question here but without any replay.

Upvotes: 1

Views: 225

Answers (1)

InternationalCodingGuru
InternationalCodingGuru

Reputation: 2258

For the 2nd view controller, set the modal presentation style to UIModalPresentationCurrentContext

Upvotes: 1

Related Questions