'Tried to pop to a view controller that doesn't exist.'

前端 未结 11 983
清酒与你
清酒与你 2021-02-05 12:13

I am getting this error when I call my method dismissView. Here is the method stub:

-(IBAction)dismissView
{
    RootViewController *rootController = [[RootViewC         


        
11条回答
  •  梦谈多话
    2021-02-05 12:51

    The -popToViewController is used to pop view controllers OFF the stack, down to one that already exists. Your UINavigationController has a stack of ViewControllers (stored in the viewControllers property), when you popToViewController, you're going to want to pass one of the elements in that array as the first argument.

    What you most likely want to do in this case is use -popViewControllerAnimated:, which will remove the top ViewController from the stack

提交回复
热议问题