diff --git a/GRKPageViewController/GRKPageViewController.h b/GRKPageViewController/GRKPageViewController.h index 5f5fc0d..77d745f 100644 --- a/GRKPageViewController/GRKPageViewController.h +++ b/GRKPageViewController/GRKPageViewController.h @@ -89,4 +89,12 @@ */ - (void)setCurrentIndex:(NSUInteger)index animated:(BOOL)animated; +/** + If you change the count of viewControllers after viewDidLoad, call this method to recalculate the + scrollView content size. + e.g. PageViewController is added to the screen upon viewHiearchy setup, but your data + is coming in asynchronously. + */ +- (void) updatePageLayout; + @end diff --git a/GRKPageViewController/GRKPageViewController.m b/GRKPageViewController/GRKPageViewController.m index da3bd26..34457ce 100644 --- a/GRKPageViewController/GRKPageViewController.m +++ b/GRKPageViewController/GRKPageViewController.m @@ -91,6 +91,11 @@ - (void)initPages #pragma mark - Acessors +- (void) updatePageLayout +{ + [self initPages]; +} + - (void)setCurrentIndex:(NSUInteger)currentIndex { [self setCurrentIndex:currentIndex animated:NO];