summaryrefslogtreecommitdiff
path: root/platform/ios/Classes
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2014-01-13 13:52:07 +0000
committerPaul Gardiner <paul.gardiner@artifex.com>2014-01-13 13:52:07 +0000
commitb35b2c96ba29cecfe91f3d429b2fb4717981f70a (patch)
treed6885128fa684543acd8cd1bd38c53b0fafc864a /platform/ios/Classes
parent1453f662e9bfd4eaacd6edee4f09e60521d46d45 (diff)
downloadmupdf-b35b2c96ba29cecfe91f3d429b2fb4717981f70a.tar.xz
iOS: attach the slider to the toolbar differently for iOS 7
Under iOS 7, the slider becomes inoperable when included a toolbar item in the standard way. Instead just add it as a subview, being careful to also remove it to avoid multiple copies
Diffstat (limited to 'platform/ios/Classes')
-rw-r--r--platform/ios/Classes/MuDocumentController.m20
1 files changed, 18 insertions, 2 deletions
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m
index 0e3beb1e..4e805df1 100644
--- a/platform/ios/Classes/MuDocumentController.m
+++ b/platform/ios/Classes/MuDocumentController.m
@@ -230,9 +230,12 @@ static void saveDoc(char *current_path, fz_document *doc)
[slider setMaximumValue: fz_count_pages(doc) - 1];
[slider addTarget: self action: @selector(onSlide:) forControlEvents: UIControlEventValueChanged];
- sliderWrapper = [[UIBarButtonItem alloc] initWithCustomView: slider];
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0)
+ {
+ sliderWrapper = [[UIBarButtonItem alloc] initWithCustomView: slider];
- [self setToolbarItems: [NSArray arrayWithObjects: sliderWrapper, nil]];
+ [self setToolbarItems: [NSArray arrayWithObjects: sliderWrapper, nil]];
+ }
// Set up the buttons on the navigation and search bar
@@ -302,6 +305,9 @@ static void saveDoc(char *current_path, fz_document *doc)
[slider setValue: current];
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
+ [[[self navigationController] toolbar] addSubview:slider];
+
[indicator setText: [NSString stringWithFormat: @" %d of %d ", current+1, fz_count_pages(doc)]];
[[self navigationController] setToolbarHidden: NO animated: animated];
@@ -321,6 +327,13 @@ static void saveDoc(char *current_path, fz_document *doc)
[sliderWrapper setWidth: SLIDER_W];
[searchBar setFrame: CGRectMake(0,0,SEARCH_W,32)];
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
+ {
+ CGRect r = [[self navigationController] toolbar].frame;
+ r.origin.x = 0;
+ r.origin.y = 0;
+ [slider setFrame:r];
+ }
[[[self navigationController] toolbar] setNeedsLayout]; // force layout!
@@ -349,6 +362,9 @@ static void saveDoc(char *current_path, fz_document *doc)
- (void) viewWillDisappear: (BOOL)animated
{
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
+ [slider removeFromSuperview];
+
[self setTitle: @"Resume"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey: @"OpenDocumentKey"];
[[self navigationController] setToolbarHidden: YES animated: animated];