Skip to content

Commit 9fd28d0

Browse files
committed
Added a proper fix for missing pages on insertion.
1 parent 79fa7eb commit 9fd28d0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

SCPageViewController/SCPageViewController.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ - (void)_tilePages
479479

480480
for (NSUInteger pageIndex = firstNeededPageIndex; pageIndex <= lastNeededPageIndex; pageIndex++) {
481481

482+
if([self.insertionIndexes containsIndex:pageIndex]) {
483+
continue;
484+
}
485+
482486
UIViewController *page = [self viewControllerForPageAtIndex:pageIndex];
483487
if (!page) {
484488
[self _createAndInsertNewPageAtIndex:pageIndex];
@@ -1181,6 +1185,8 @@ - (void)insertPagesAtIndexes:(NSIndexSet *)indexes animated:(BOOL)animated compl
11811185
dispatch_group_notify(animationsDispatchGroup, dispatch_get_main_queue(), ^{
11821186

11831187
self.insertionIndexes = nil;
1188+
[self _tilePages];
1189+
11841190
if(completion) {
11851191
completion();
11861192
}
@@ -1283,6 +1289,8 @@ - (void)deletePagesAtIndexes:(NSIndexSet *)indexes animated:(BOOL)animated compl
12831289
[self.visibleControllers removeObject:viewController];
12841290
}
12851291

1292+
[self _tilePages];
1293+
12861294
if(completion) {
12871295
completion();
12881296
}

0 commit comments

Comments
 (0)