Calling popToRootViewControllerAnimated after dismissModalViewControllerAnimated

前端 未结 4 1475
孤独总比滥情好
孤独总比滥情好 2021-01-05 14:04

I am working application in which i calling presentModalViewController and once finished(calling dismissModalViewControllerAnimated:YES) it should

4条回答
  •  甜味超标
    2021-01-05 14:42

    I ran into something similar to this. You need to make a copy of your self.navigationcontroller first and also retain yourself, so when you call the second pop, there is still a reference to the NC and you still exist.

        // locally store the navigation controller since
        // self.navigationController will be nil once we are popped
    UINavigationController *navController = self.navigationController;
    
        // retain ourselves so that the controller will still exist once it's popped off
    [[self retain] autorelease];
    
        // Pop this controller and replace with another
    [navController popViewControllerAnimated:NO];
    [navController pushViewController:someViewController animated:NO];
    

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

提交回复
热议问题