|
@@ -98,7 +98,10 @@
|
|
|
}
|
|
|
|
|
|
- (void)viewWillLayoutSubviews {
|
|
|
-
|
|
|
+ CGFloat height = 50.0;
|
|
|
+ if (@available(iOS 11.0, *))
|
|
|
+ height += self.view.safeAreaInsets.bottom;
|
|
|
+ self.pageEditToolBar.frame = CGRectMake(0, self.view.frame.size.height - height, self.view.frame.size.width, height);
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
self.headerView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.safeAreaInsets.top + 50);
|
|
|
self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, self.view.safeAreaInsets.top, 120, 50);
|
|
@@ -125,11 +128,7 @@
|
|
|
self.editBtn.hidden = YES;
|
|
|
self.isSelecAll = NO;
|
|
|
|
|
|
- CGFloat height = 50.0;
|
|
|
- if (@available(iOS 11.0, *))
|
|
|
- height += self.view.safeAreaInsets.bottom;
|
|
|
-
|
|
|
- self.pageEditToolBar = [[CPageEditToolBar alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - height, self.view.frame.size.width, height)];
|
|
|
+ self.pageEditToolBar = [[CPageEditToolBar alloc] init];
|
|
|
self.pageEditToolBar.pdfView = self.pdfView;
|
|
|
self.pageEditToolBar.currentPageIndex = -1;
|
|
|
self.pageEditToolBar.delegate = self;
|
|
@@ -248,6 +247,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)refreshPageIndex {
|
|
|
+ NSInteger count = [self.collectionView numberOfItemsInSection:0];
|
|
|
+ for (NSInteger i = 0; i < count; i++) {
|
|
|
+ NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0];
|
|
|
+ CPDFPageEditViewCell *cell = (CPDFPageEditViewCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
|
|
|
+ cell.textLabel.text = [NSString stringWithFormat:@"%lu", i+1];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - GestureRecognized
|
|
|
|
|
|
- (void)longPressGestureRecognized:(UILongPressGestureRecognizer *)gestureRecognizer {
|
|
@@ -272,7 +280,7 @@
|
|
|
case UIGestureRecognizerStateEnded:
|
|
|
{
|
|
|
[self.collectionView endInteractiveMovement];
|
|
|
- [self.collectionView reloadData];
|
|
|
+ [self refreshPageIndex];
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -312,7 +320,6 @@
|
|
|
[self.pdfView.document movePageAtIndex:sourceIndexPath.item withPageAtIndex:destinationIndexPath.item];
|
|
|
self.isPageEdit = YES;
|
|
|
[self updateTitle];
|
|
|
- [self.collectionView reloadData];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -431,7 +438,6 @@
|
|
|
}
|
|
|
[self.collectionView reloadItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]];
|
|
|
[self.collectionView selectItemAtIndexPath:indexPath animated:NO scrollPosition:UICollectionViewScrollPositionNone];
|
|
|
-;
|
|
|
}
|
|
|
[self updateTitle];
|
|
|
[self.pageEditToolBar reloadData];
|