summaryrefslogtreecommitdiff
path: root/platform/ios/Classes/MuDocumentController.m
diff options
context:
space:
mode:
authorMatt Holgate <matt@emobix.co.uk>2014-07-07 12:30:25 +0100
committerMatt Holgate <matt@emobix.co.uk>2014-07-07 12:30:25 +0100
commit184c4f75f9697877c7a8f1d512bef23f557b0c04 (patch)
treef4906f0e1397fbeced24240d4efb755f54ab00e4 /platform/ios/Classes/MuDocumentController.m
parent0144342e08e2bbd0be9a7ae562a7053be12dcb1e (diff)
downloadmupdf-184c4f75f9697877c7a8f1d512bef23f557b0c04.tar.xz
Fix disabled state of bar buttons on iPhone/iPod Touch.
Previously on iOS 7, bar buttons didn't change visually when disabled. Also improves the look and feel - the buttons are now tinted in the highlighted state rather than showing a grey background. On iOS 7, the iPhone/iPad buttons style match. Tested on iOS 6 iPad/iPod and iOS 7 iPad/iPod.
Diffstat (limited to 'platform/ios/Classes/MuDocumentController.m')
-rw-r--r--platform/ios/Classes/MuDocumentController.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m
index c9ac2e66..36f2c867 100644
--- a/platform/ios/Classes/MuDocumentController.m
+++ b/platform/ios/Classes/MuDocumentController.m
@@ -1,6 +1,5 @@
#include "common.h"
-#import <TapImage.h>
#import "MuPageViewNormal.h"
#import "MuPageViewReflow.h"
#import "MuDocumentController.h"
@@ -165,10 +164,15 @@ static void saveDoc(char *current_path, fz_document *doc)
}
else
{
- UIView *iv = [[TapImage alloc] initWithResource:resource target:self action:selector];
- UIBarButtonItem *ib = [[UIBarButtonItem alloc] initWithCustomView:iv];
- [iv release];
- return ib;
+ UIView *buttonView;
+ BOOL iOS7Style = ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f);
+ UIButton *button = [UIButton buttonWithType:iOS7Style ? UIButtonTypeSystem : UIButtonTypeCustom];
+ [button setImage:[UIImage imageNamed:resource] forState:UIControlStateNormal];
+ [button addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
+ [button sizeToFit];
+ buttonView = button;
+
+ return [[UIBarButtonItem alloc] initWithCustomView:buttonView];
}
}