UIPageViewController 重新加载数据并更新 VC

UIPageViewController reload data and update VC

我已经有了自己的基于 this 教程的页面控制器。 数组更改后如何重新加载 ViewController?

我想重新加载并仅显示现有项目。

由于您没有发布任何代码,因此我假设您已完成教程中的所有操作。 你需要的是确保你的数组不是用 ViewController 初始化的,而是单独初始化的。之后只要 [self createPageViewController] 需要刷新它。

更好的方法是使用:

 if([contentImages count])
 {
    NSArray *startingViewControllers = @[[self itemControllerForIndex: 0]];
    [pageController setViewControllers: startingViewControllers
                             direction: UIPageViewControllerNavigationDirectionForward
                              animated: NO
                            completion: nil];
 }

我无法对此进行测试,但如果示例正确,应该可以。