Modal representation is biased

I have the following code to show a modal view that is added as a subtitle of my tabBarController. However, despite using the autoresizingMask property, which allows, when an incoming cellular call terminates my application and shows a green status bar at the top, I find after this event the whole view is shifted 20 pixels down

    - (void) showLogin:(UIView*) modalView
   {
     CGPoint middleCenter = CGPointMake(160, 226);
     CGSize offSize = [UIScreen mainScreen].bounds.size;
     CGPoint offScreenCenter = CGPointMake(offSize.width / 2.0, -210); // start from top
     modalView.center = offScreenCenter; // we start off-screen
         modalView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
    [self.tabBarController.view addSubview:modalView];

    // Show it with a transition effect
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.4]; // animation duration in seconds
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    modalView.center = middleCenter;
    [UIView commitAnimations];
   } 

How to solve this? Thanks

+3
source share
3 answers

Isn't that a simulator and device problem?

The panel just appears on the simulator. But this will never happen on a real device.

. . "", .

+2

?

, modalView , .

[self.tabBarController.view presentModalViewController: ... animated: YES];
+1

You can override -(void)layoutSubviewsin self.tabBarController.view, check the new boundaries of this view and manually change the appearance of the login as the boundaries change.

+1
source

All Articles