UIPageViewController 更新页数

UIPageViewController update number of pages

大家好,我想看看是否有人知道如何更新 UIPageViewController 中的页数

UIPageViewController 有方法

- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController {
    return count;
}

但是那是一开始就调用的,没有办法更新它。 使用 table 视图,您可以调用 [tableView reloadData]

有谁知道如何"reload" UIPageViewController 的数据?

谢谢大家

使用 UIPageViewController 的 setViewControllers 方法:

- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers 
             direction:(UIPageViewControllerNavigationDirection)direction 
             animated:(BOOL)animated 
             completion:(void (^)(BOOL finished))completion;

在 UIPageViewController 上调用此方法,并将其传递给您想要显示的视图控制器。