代码之家  ›  专栏  ›  技术社区  ›  Jordan

以编程方式更改ViewController

  •  1
  • Jordan  · 技术社区  · 14 年前

    navigationController-->ViewControllerA--ViewControllerB(当前显示)。

    和导航控制器-->ViewController1-->ViewController2。

    我想从ViewControllerB转到ViewController2。

    以下是我尝试的:

    [self.navigationController popToRootViewControllerAnimated:YES]; // Works fine
    AppDelegate app* = [[UIApplication sharedApplication] delegate];
    LocationsViewController*  locationsViewController = [[LocationsViewController alloc] initWithNibName:@"LocationsView" bundle:nil];
    
    locationsViewController.title = @"Title";
    [self.navigationController pushViewController:locationsViewController animated:YES];
    

    这个自动导航控制器pushViewController不工作。

    你怎么解决这个问题?

    1 回复  |  直到 14 年前
        1
  •  1
  •   Jordan    14 年前

    http://discussions.apple.com/thread.jspa?threadID=2305421&tstart=0#10929636

    显然,如果您在poptorootviewcontroller上按下另一个视图控制器,它就无法设置动画。

    谢谢!