iOS8 issue when trying to push multiple UIViewControllers in NavigationController

限于喜欢 提交于 2019-12-08 15:23:28
Heinz

Use the method:

- (void)setViewControllers:(NSArray *)viewControllers
              animated:(BOOL)animated

to set all the controllers at a time showing only the last.

In your case:

- (void) JumpTo6 {
  UINavigationController *nav = self.navigationController;
  UIViewController *a = [self.storyboard instantiateViewControllerWithIdentifier:@"2"];
  UIViewController *b = [self.storyboard instantiateViewControllerWithIdentifier:@"3"];
  UIViewController *c = [self.storyboard instantiateViewControllerWithIdentifier:@"4"];
  UIViewController *d = [self.storyboard instantiateViewControllerWithIdentifier:@"5"];
  UIViewController *e = [self.storyboard instantiateViewControllerWithIdentifier:@"6"];
  NSArray *viewControllers = nav.viewControllers;
  NSArray *newViewControllers = [NSArray arrayWithObjects:a, b, c, d, e, nil];
  [nav setViewControllers:[viewControllers arrayByAddingObjectsFromArray:newViewControllers] animated:YES];
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!