博客> iOS开发 跳转到指定界面(栈中不存在的界面)
iOS开发 跳转到指定界面(栈中不存在的界面)
10分钟前 评论:0 阅读:246 shebaokahao

NSMutableArray *viewControllers = [self.navigationController.viewControllers mutableCopy];

for (int i = 0; i < viewControllers.count; i++){ id vc = viewControllers[i]; //1.找到要插入界面的前一个界面 if ([vc isKindOfClass:[LoginViewController class]]){ UserViewController *insertVC = [[UserViewController alloc] init]; //2.插入到界面栈中 [viewControllers insertObject:insertVC atIndex:i + 1]; //3.更新界面栈 [self.navigationController setViewControllers:viewControllers animated:NO]; //4.跳转到指定界面 [self.navigationController popToViewController:insertVC animated:YES];

    return;
  }

}

收藏
0
sina weixin mail 回到顶部