|
@@ -32,10 +32,9 @@
|
|
|
|
|
|
#pragma mark - Initializers
|
|
|
|
|
|
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument currentPageIndex:(NSInteger)pageIndex {
|
|
|
+- (instancetype)initWithPDFView:(CPDFView *)pdfView {
|
|
|
if (self = [super init]) {
|
|
|
- _pdfDocument = pdfDocument;
|
|
|
- _pageIndex = pageIndex;
|
|
|
+ _pdfView = pdfView;
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
@@ -43,39 +42,39 @@
|
|
|
#pragma mark - Accessors
|
|
|
|
|
|
- (UISegmentedControl *)segmentedControl {
|
|
|
+ CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
if (!_segmentedControl) {
|
|
|
- CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
NSArray *segmmentArray = [NSArray arrayWithObjects:NSLocalizedString(@"Thumbnail", nil), NSLocalizedString(@"Outline", nil), nil];
|
|
|
-
|
|
|
_segmentedControl = [[UISegmentedControl alloc] initWithItems:segmmentArray];
|
|
|
_segmentedControl.frame = CGRectMake(self.view.frame.size.width / 4, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 5 , self.view.frame.size.width / 2, 30);
|
|
|
- _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
|
|
|
[_segmentedControl addTarget:self action:@selector(segmentedControlValueChanged_BOTA:) forControlEvents:UIControlEventValueChanged];
|
|
|
}
|
|
|
+ _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
|
|
return _segmentedControl;
|
|
|
}
|
|
|
|
|
|
- (CPDFThumbnailViewController *)thumbnailViewController {
|
|
|
+ CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
if (!_thumbnailViewController) {
|
|
|
- CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
- _thumbnailViewController = [[CPDFThumbnailViewController alloc] initWithDocument:self.pdfDocument currentPageIndex:self.pageIndex];
|
|
|
- _thumbnailViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 35, self.view.bounds.size.width, self.view.bounds.size.height);
|
|
|
+ _thumbnailViewController = [[CPDFThumbnailViewController alloc] initWithPDFView:self.pdfView];
|
|
|
_thumbnailViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
|
|
|
_thumbnailViewController.delegate = self;
|
|
|
[self addChildViewController:_thumbnailViewController];
|
|
|
}
|
|
|
+ _thumbnailViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 45, self.view.bounds.size.width, self.view.bounds.size.height);
|
|
|
return _thumbnailViewController;
|
|
|
}
|
|
|
|
|
|
- (CPDFOutlineViewController *)outlineViewController {
|
|
|
+ CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
if (!_outlineViewController) {
|
|
|
- CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
- _outlineViewController = [[CPDFOutlineViewController alloc] initWithDocument:self.pdfDocument];
|
|
|
- _outlineViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 35, self.view.bounds.size.width, self.view.bounds.size.height);
|
|
|
+ _outlineViewController = [[CPDFOutlineViewController alloc] initWithPDFView:self.pdfView];
|
|
|
_outlineViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
|
|
|
_outlineViewController.delegate = self;
|
|
|
[self addChildViewController:_outlineViewController];
|
|
|
}
|
|
|
+ _outlineViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 45, self.view.bounds.size.width, self.view.bounds.size.height);
|
|
|
+
|
|
|
return _outlineViewController;
|
|
|
}
|
|
|
|
|
@@ -112,15 +111,17 @@
|
|
|
#pragma mark - CPDFOutlineViewControllerDelegate
|
|
|
|
|
|
- (void)outlineViewController:(CPDFOutlineViewController *)outlineViewController forPageIndex:(NSInteger)pageIndex {
|
|
|
- [self.delegate botaViewController:self thumbnailForPageIndex:pageIndex];
|
|
|
- [self.navigationController popViewControllerAnimated:NO];
|
|
|
+ [self.pdfView goToPageIndex:pageIndex animated:NO];
|
|
|
+
|
|
|
+ [self.delegate botaViewControllerDismiss:self];
|
|
|
}
|
|
|
|
|
|
#pragma mark - CPDFThumbnailViewControllerDelegate
|
|
|
|
|
|
- (void)thumbnailViewController:(CPDFThumbnailViewController *)thumbnailViewController forPageIndex:(NSInteger)pageIndex {
|
|
|
- [self.delegate botaViewController:self outlineForPageIndex:pageIndex];
|
|
|
- [self.navigationController popViewControllerAnimated:NO];
|
|
|
+ [self.pdfView goToPageIndex:pageIndex animated:NO];
|
|
|
+
|
|
|
+ [self.delegate botaViewControllerDismiss:self];
|
|
|
}
|
|
|
|
|
|
@end
|