Does the navigation bar jump out of the status bar?

I have a button in my main view controller that pushes a navigation controller with a built-in view controller using segue.

When a new view controller is presented, the navigation bar in the status bar briefly appears on it. (The status bar is not hidden.) The content (which refers to the top layout guide) is in the right place. Once the animation is complete, it corrects itself.

When you view the view again, the same thing happens: the main view controller briefly overwrites the status bar. For the main view controller, this is a bit more important as it is based on UITableViewController; the whole table jumps. Again, when the animation is complete, the view controller locks itself.

I tried to turn off the transparency in the navigation bar, but that only makes the problem more obvious. It all works as expected on iOS 6.

I downloaded a minimalist test case here: https://github.com/tewha/FlipTest

+4
source share
4 answers

Another simple trick:

In masterviewcontroller

When preparing for Segue:

 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    [UIView transitionWithView:self.navigationController.view
                      duration:0.75
                       options:UIViewAnimationOptionTransitionFlipFromRight
                    animations:nil
                    completion:nil];
}

AboutViewController

- (IBAction)aboutUnwind:(UIStoryboardSegue *)segue {

[UIView transitionWithView:((UIViewController *)segue.sourceViewController).view
                  duration:0.75
                   options:UIViewAnimationOptionTransitionFlipFromLeft
                animations:nil
                completion:nil];

}

+2

iOS7. , ( !) y = , - , "" .

, , iOS7.1b1.

+1

ios 7 , .

iOS 7 , , iOS. , . , , .

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;

, iOS 7, / viewDidAppear

0

.

'performSegueWithIdentifier' 'presentViewController'

, , UIView.

-(void)photoButtonPressed:(NSNotification*)notification
{        
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Media"
                                                         bundle:nil];

    UINavigationController *navCon = [storyboard instantiateInitialViewController];

    PhotoCaptureViewController *controller = navCon.viewControllers.firstObject;
    controller.delegate = self;

    CustomTabBarViewController *tabBarController = (CustomTabBarViewController*)self.tabBarController;

    [UIView transitionWithView:self.navigationController.view duration:0.75 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
                        [tabBarController.parentViewController addChildViewController:navCon];
                        [tabBarController.parentViewController.view addSubview:navCon.view];
                    } completion:^(BOOL finished) {
                        [navCon didMoveToParentViewController:tabBarController.parentViewController];
                    }];
}

-(void)photoCaptureViewController:(PhotoCaptureViewController *)controller dismissButtonPressed:(UIButton *)dismissButton
{
    CustomTabBarViewController *tabBarController = (CustomTabBarViewController*)self.tabBarController;

    [UIView transitionFromView:controller.navigationController.view toView:tabBarController.view duration:1 options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {
        [controller.navigationController willMoveToParentViewController:nil];
        [controller.navigationController removeFromParentViewController];
        [controller.navigationController.view removeFromSuperview];
    }];

}

Khanlou

0
source

All Articles