|
@@ -15,7 +15,7 @@
|
|
|
#import <ComPDFKit/ComPDFKit.h>
|
|
|
#import <compdfkit_tools/compdfkit_tools.h>
|
|
|
|
|
|
-@interface CPDFViewController ()<UISearchBarDelegate,CPDFViewDelegate,CPDFListViewDelegate, CPDFMoreListViewDelegate, CSearchToolbarDelegate, CPDFDisplayViewDelegate, CPDFBOTAViewControllerDelegate,CPDFSearchResultsDelegate, CPDFThumbnailViewControllerDelegate>
|
|
|
+@interface CPDFViewController ()<UISearchBarDelegate,CPDFViewDelegate,CPDFListViewDelegate, CPDFMoreListViewDelegate, CSearchToolbarDelegate, CPDFDisplayViewDelegate, CPDFBOTAViewControllerDelegate,CPDFSearchResultsDelegate, CPDFThumbnailViewControllerDelegate,CPDFPopMenuViewDelegate>
|
|
|
|
|
|
@property(nonatomic, strong) NSString *filePath;
|
|
|
|
|
@@ -29,6 +29,11 @@
|
|
|
|
|
|
@property(nonatomic, strong) NSString *navigationTitle;
|
|
|
|
|
|
+@property(nonatomic, strong) CNavigationBarTitleButton * titleButton;
|
|
|
+
|
|
|
+@property(nonatomic, strong) CPDFPopMenu *popMenu;
|
|
|
+
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation CPDFViewController
|
|
@@ -74,17 +79,41 @@
|
|
|
|
|
|
}];
|
|
|
|
|
|
+ //titleButton
|
|
|
+ CNavigationBarTitleButton * navTitleButton = [[CNavigationBarTitleButton alloc] init];
|
|
|
+ CGRect frame = navTitleButton.frame;
|
|
|
+ frame.size.width = 35;
|
|
|
+ navTitleButton.frame = frame;
|
|
|
+ self.titleButton = navTitleButton;
|
|
|
+ self.navigationItem.titleView = navTitleButton;
|
|
|
+
|
|
|
+ [navTitleButton setImage:[UIImage imageNamed:@"syasarrow"] forState:UIControlStateNormal];
|
|
|
+ [navTitleButton addTarget:self action:@selector(titleButtonClickd:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+
|
|
|
self.searchToolbar = [[CSearchToolbar alloc] initWithPDFView:self.pdfListView];
|
|
|
self.searchToolbar.delegate = self;
|
|
|
|
|
|
[self reloadDocumentWithFilePath:self.filePath completion:^(BOOL result) {
|
|
|
|
|
|
}];
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void) titleButtonClickd:(UIButton *) button {
|
|
|
+ NSLog(@"titleButton Click");
|
|
|
}
|
|
|
|
|
|
- (void)viewWillLayoutSubviews {
|
|
|
[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, 155)];
|
|
|
+ } else {
|
|
|
+ // Fallback on earlier versions
|
|
|
+ [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - 250, -10, 250, 155)];
|
|
|
+ }
|
|
|
+
|
|
|
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);
|
|
|
} else {
|
|
@@ -100,6 +129,8 @@
|
|
|
|
|
|
self.title = [[filePath lastPathComponent] stringByDeletingPathExtension];
|
|
|
_navigationTitle = self.title;
|
|
|
+ //
|
|
|
+ [self.titleButton setTitle:self.title forState:UIControlStateNormal];
|
|
|
[self.navigationController.view setUserInteractionEnabled:NO];
|
|
|
|
|
|
if (![self.loadingView superview]) {
|
|
@@ -147,13 +178,28 @@
|
|
|
- (void)navigationRightItemBota {
|
|
|
CPDFBOTAViewController *botaViewController = [[CPDFBOTAViewController alloc] initWithPDFView:self.pdfListView];
|
|
|
botaViewController.delegate = self;
|
|
|
- [self.navigationController pushViewController:botaViewController animated:NO];
|
|
|
+// [self.navigationController pushViewController:botaViewController animated:NO];
|
|
|
+
|
|
|
+ AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
|
|
|
+
|
|
|
+ presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:botaViewController presentingViewController:self];
|
|
|
+ botaViewController.transitioningDelegate = presentationController;
|
|
|
+
|
|
|
+ [self presentViewController:botaViewController animated:YES completion:nil];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)navigationRightItemMore {
|
|
|
- CPDFMoreListViewController * moreListVc = [[CPDFMoreListViewController alloc] init];
|
|
|
- moreListVc.delegate = self;
|
|
|
- [self.navigationController pushViewController:moreListVc animated:YES];
|
|
|
+ CPDFPopMenuView * menuView = [[CPDFPopMenuView alloc] initWithFrame:CGRectMake(0, 0, 200, 155)];
|
|
|
+ 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, 155)];
|
|
|
+ } else {
|
|
|
+ // Fallback on earlier versions
|
|
|
+ [self.popMenu showMenuInRect:CGRectMake(self.view.frame.size.width - 250, -10, 250, 155)];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- (void)buttonItemClicked_thumbnail:(id)sender {
|
|
@@ -291,4 +337,34 @@
|
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
|
}
|
|
|
|
|
|
+#pragma mark - CPDFMenuViewdelegate
|
|
|
+- (void)menuDidClickAtView:(CPDFPopMenuView *)view clickType:(CPDFPopMenuViewType)viewType {
|
|
|
+ switch (viewType) {
|
|
|
+ case CPDFPopMenuViewTypeSetting:
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CPDFPopMenuViewTypeInfo:
|
|
|
+ {
|
|
|
+ [self.popMenu hideMenu];
|
|
|
+ CPDFInfoViewController * infoVc = [[CPDFInfoViewController alloc] initWithPDFView:self.pdfListView];
|
|
|
+
|
|
|
+ AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
|
|
|
+ presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:infoVc presentingViewController:self];
|
|
|
+ infoVc.transitioningDelegate = presentationController;
|
|
|
+ [self presentViewController:infoVc animated:YES completion:nil];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CPDFPopMenuViewTypeShare:
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
@end
|