|
@@ -52,9 +52,14 @@
|
|
|
|
|
|
self.view.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
|
|
|
self.pdfListView = [[CPDFListView alloc] initWithFrame:self.view.bounds];
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, 0, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - self.view.safeAreaInsets.bottom);
|
|
|
+ } else {
|
|
|
+ self.pdfListView.frame = self.view.bounds;
|
|
|
+ }
|
|
|
self.pdfListView.performDelegate = self;
|
|
|
self.pdfListView.delegate = self;
|
|
|
- self.pdfListView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
+// self.pdfListView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
|
[self.view addSubview:self.pdfListView];
|
|
|
|
|
|
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"CPDFThunbnailImageEnter" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] style:UIBarButtonItemStylePlain target:self action:@selector(buttonItemClicked_thumbnail:)];
|
|
@@ -106,16 +111,22 @@
|
|
|
[super viewWillLayoutSubviews];
|
|
|
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
- [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - self.view.safeAreaInsets.right - 250, self.view.safeAreaInsets.top - 10, 250, 200)];
|
|
|
+ [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - self.view.safeAreaInsets.right - 250, CGRectGetMaxY(self.navigationController.navigationBar.frame), 250, 200)];
|
|
|
} else {
|
|
|
// Fallback on earlier versions
|
|
|
- [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - 250, -10, 250, 200)];
|
|
|
+ [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - 250, CGRectGetMaxY(self.navigationController.navigationBar.frame), 250, 200)];
|
|
|
+ }
|
|
|
+
|
|
|
+ CGFloat tPosY = 0;
|
|
|
+ if (!self.navigationController.navigationBarHidden) {
|
|
|
+ CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
+ tPosY = self.navigationController.navigationBar.frame.size.height + rectStatus.size.height;
|
|
|
}
|
|
|
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
- self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, self.view.safeAreaInsets.top, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - self.view.safeAreaInsets.bottom- self.view.safeAreaInsets.top);
|
|
|
+ self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - self.view.safeAreaInsets.bottom- tPosY);
|
|
|
} else {
|
|
|
- self.pdfListView.frame = self.view.bounds;
|
|
|
+ self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -191,11 +202,12 @@
|
|
|
menuView.delegate = self;
|
|
|
self.popMenu = [CPDFPopMenu popMenuWithContentView:menuView];
|
|
|
self.popMenu.dimCoverLayer = YES;
|
|
|
+
|
|
|
if (@available(iOS 11.0, *)) {
|
|
|
- [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - self.view.safeAreaInsets.right - 250, self.view.safeAreaInsets.top - 10, 250, 200)];
|
|
|
+ [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - self.view.safeAreaInsets.right - 250, CGRectGetMaxY(self.navigationController.navigationBar.frame), 250, 200)];
|
|
|
} else {
|
|
|
// Fallback on earlier versions
|
|
|
- [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - 250, -10, 250, 200)];
|
|
|
+ [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - 250, CGRectGetMaxY(self.navigationController.navigationBar.frame), 250, 200)];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -225,34 +237,26 @@
|
|
|
#pragma mark - CPDFListViewDelegate
|
|
|
|
|
|
- (void)PDFListViewPerformTouchEnded:(CPDFListView *)pdfView {
|
|
|
- if (CPDFViewAnnotationModeNone != self.pdfListView.annotationMode) {
|
|
|
- self.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
|
|
|
- return;
|
|
|
+ CGFloat tPosY = 0;
|
|
|
+ if (self.navigationController.navigationBarHidden) {
|
|
|
+ [self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ self.pdfListView.pageSliderView.alpha = 1.0;
|
|
|
+ }];
|
|
|
+ CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
+ tPosY = self.navigationController.navigationBar.frame.size.height + rectStatus.size.height;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ [self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ self.pdfListView.pageSliderView.alpha = 0.0;
|
|
|
+ }];
|
|
|
}
|
|
|
- if (UIUserInterfaceIdiomPhone == UI_USER_INTERFACE_IDIOM()) {
|
|
|
- if (self.navigationController.navigationBarHidden) {
|
|
|
- [self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
|
- [UIView animateWithDuration:0.3 animations:^{
|
|
|
- self.pdfListView.pageSliderView.alpha = 1.0;
|
|
|
- }];
|
|
|
- } else {
|
|
|
- [self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
|
- [UIView animateWithDuration:0.3 animations:^{
|
|
|
- self.pdfListView.pageSliderView.alpha = 0.0;
|
|
|
- }];
|
|
|
- }
|
|
|
+
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - self.view.safeAreaInsets.bottom- tPosY);
|
|
|
} else {
|
|
|
- if (self.navigationController.navigationBarHidden) {
|
|
|
- [self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
|
- [UIView animateWithDuration:0.3 animations:^{
|
|
|
- self.pdfListView.pageSliderView.alpha = 1.0;
|
|
|
- }];
|
|
|
- } else {
|
|
|
- [self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
|
- [UIView animateWithDuration:0.3 animations:^{
|
|
|
- self.pdfListView.pageSliderView.alpha = 0.0;
|
|
|
- }];
|
|
|
- }
|
|
|
+ self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY);
|
|
|
}
|
|
|
}
|
|
|
|