How can I pop a view from a UINavigationController and replace it with another in one operation?

后端 未结 16 2212
谎友^
谎友^ 2020-11-27 10:01

I have an application where I need to remove one view from the stack of a UINavigationController and replace it with another. The situation is that the first view creates an

16条回答
  •  甜味超标
    2020-11-27 10:26

    Thanks, this was exactly what I needed. I also put this in an animation to get the page curl:

            MyEditViewController *mevc = [[MYEditViewController alloc] initWithGizmo: gizmo];
    
        UINavigationController *navController = self.navigationController;      
        [[self retain] autorelease];
    
        [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 0.7];
        [UIView setAnimationTransition:<#UIViewAnimationTransitionCurlDown#> forView:navController.view cache:NO];
    
        [navController popViewControllerAnimated:NO];
        [navController pushViewController:mevc animated:NO];
    
        [UIView commitAnimations];
    

    0.6 duration is fast, good for 3GS and newer, 0.8 is still a bit too fast for 3G..

    Johan

提交回复
热议问题