|
@@ -35,48 +35,13 @@
|
|
|
- (instancetype)initWithPDFView:(CPDFView *)pdfView {
|
|
|
if (self = [super init]) {
|
|
|
_pdfView = pdfView;
|
|
|
+
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
#pragma mark - Accessors
|
|
|
|
|
|
-- (UISegmentedControl *)segmentedControl {
|
|
|
- CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
- if (!_segmentedControl) {
|
|
|
- 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 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) {
|
|
|
- _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) {
|
|
|
- _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;
|
|
|
-}
|
|
|
|
|
|
#pragma mark - UIViewController Methods
|
|
|
|
|
@@ -87,6 +52,28 @@
|
|
|
|
|
|
self.view.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
|
|
|
|
|
|
+ NSArray *segmmentArray = [NSArray arrayWithObjects:NSLocalizedString(@"Thumbnail", nil), NSLocalizedString(@"Outline", nil), nil];
|
|
|
+ CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
+ self.segmentedControl = [[UISegmentedControl alloc] initWithItems:segmmentArray];
|
|
|
+ self.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);
|
|
|
+ [self.segmentedControl addTarget:self action:@selector(segmentedControlValueChanged_BOTA:) forControlEvents:UIControlEventValueChanged];
|
|
|
+ self.segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
|
|
+
|
|
|
+
|
|
|
+ self.thumbnailViewController = [[CPDFThumbnailViewController alloc] initWithPDFView:self.pdfView];
|
|
|
+ self.thumbnailViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
|
|
|
+ self.thumbnailViewController.delegate = self;
|
|
|
+ [self addChildViewController:_thumbnailViewController];
|
|
|
+
|
|
|
+ self.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);
|
|
|
+
|
|
|
+
|
|
|
+ self.outlineViewController = [[CPDFOutlineViewController alloc] initWithPDFView:self.pdfView];
|
|
|
+ self.outlineViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
|
|
|
+ self.outlineViewController.delegate = self;
|
|
|
+ [self addChildViewController:_outlineViewController];
|
|
|
+ self.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);
|
|
|
+
|
|
|
self.segmentedControl.selectedSegmentIndex = 0;
|
|
|
[self.view addSubview:self.segmentedControl];
|
|
|
|