Skip to content

Commit c87e5a2

Browse files
committed
Made the buttonTintColor property available for iOS 7 and above.
1 parent 17a1378 commit c87e5a2

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

TOWebViewController.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |s|
22
s.name = 'TOWebViewController'
3-
s.version = '2.0.13'
3+
s.version = '2.0.14'
44
s.license = { :type => 'MIT', :file => 'LICENSE' }
55
s.summary = 'An inline browser view controller that allows users to view and navigate web pages from within an app.'
66
s.homepage = 'https://github.com/TimOliver/TOWebViewController'
77
s.author = 'Tim Oliver'
8-
s.source = { :git => 'https://github.com/TimOliver/TOWebViewController.git', :tag => '2.0.13' }
8+
s.source = { :git => 'https://github.com/TimOliver/TOWebViewController.git', :tag => '2.0.14' }
99
s.platform = :ios, '5.0'
1010

1111
s.source_files = 'TOWebViewController/**/*.{h,m}'

TOWebViewController/TOWebViewController.h

100644100755
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,13 @@
133133
@property (nonatomic,copy) BOOL (^shouldStartLoadRequestHandler)(NSURLRequest *request, UIWebViewNavigationType navigationType);
134134

135135
/**
136-
On iOS 6 or below, this can be used to override the default fill color of the navigation button icons.
137-
138-
Conforms to the iOS UIAppearance protocol.
136+
This can be used to override the default tint color of the navigation button icons.
139137
*/
140-
@property (nonatomic,strong) UIColor *buttonTintColor; //UI_APPEARANCE_SELECTOR
138+
@property (nonatomic,strong) UIColor *buttonTintColor;
141139

142140
/**
143141
On iOS 6 or below, this overrides the default opacity level of the bevel around the navigation buttons.
144-
145-
Conforms to the iOS UIAppearance protocol.
146142
*/
147-
@property (nonatomic,assign) CGFloat buttonBevelOpacity; //UI_APPEARANCE_SELECTOR
143+
@property (nonatomic,assign) CGFloat buttonBevelOpacity;
148144

149145
@end

TOWebViewController/TOWebViewController.m

100644100755
Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ @interface TOWebViewController () <UIActionSheetDelegate,
132132
@property (nonatomic,strong) UIButton *forwardButton; /* Moves the web view one page forward */
133133
@property (nonatomic,strong) UIButton *reloadStopButton; /* Reload / Stop buttons */
134134
@property (nonatomic,strong) UIButton *actionButton; /* Shows the UIActivityViewController */
135+
@property (nonatomic,strong) UIView *buttonsContainerView; /* The container view that holds all of the navigation buttons. */
135136

136137
/* Button placement metrics */
137138
@property (nonatomic,assign) CGFloat buttonWidth; /* The size of each button */
@@ -433,15 +434,19 @@ - (void)viewDidLoad
433434
self.gradientLayer.hidden = YES;
434435

435436
//create the buttons view and add them to either the navigation bar or toolbar
436-
UIView *iconsContainerView = [self containerViewWithNavigationButtons];
437+
self.buttonsContainerView = [self containerViewWithNavigationButtons];
437438
if (IPAD) {
438-
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:iconsContainerView];
439+
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.buttonsContainerView];
439440
}
440441
else {
441-
NSArray *items = @[BLANK_BARBUTTONITEM, [[UIBarButtonItem alloc] initWithCustomView:iconsContainerView], BLANK_BARBUTTONITEM];
442+
NSArray *items = @[BLANK_BARBUTTONITEM, [[UIBarButtonItem alloc] initWithCustomView:self.buttonsContainerView], BLANK_BARBUTTONITEM];
442443
self.toolbarItems = items;
443444
}
444445

446+
//override the tint color of the buttons, if desired.
447+
if (MINIMAL_UI)
448+
self.buttonsContainerView.tintColor = self.buttonTintColor;
449+
445450
// Create the Done button
446451
if (self.beingPresentedModally && !self.onTopOfNavigationControllerStack) {
447452
NSString *title = NSLocalizedStringFromTable(@"Done", @"TOWebViewControllerLocalizable", @"Modal Web View Controller Close");
@@ -665,11 +670,16 @@ - (void)setButtonTintColor:(UIColor *)buttonTintColor
665670

666671
_buttonTintColor = buttonTintColor;
667672

668-
if (self.buttonThemeAttributes == nil)
669-
self.buttonThemeAttributes = [NSMutableDictionary dictionary];
670-
671-
self.buttonThemeAttributes[TOWebViewControllerButtonTintColor] = _buttonTintColor;
672-
[self setUpNavigationButtons];
673+
if (MINIMAL_UI) {
674+
self.buttonsContainerView.tintColor = _buttonTintColor;
675+
}
676+
else {
677+
if (self.buttonThemeAttributes == nil)
678+
self.buttonThemeAttributes = [NSMutableDictionary dictionary];
679+
680+
self.buttonThemeAttributes[TOWebViewControllerButtonTintColor] = _buttonTintColor;
681+
[self setUpNavigationButtons];
682+
}
673683
}
674684

675685
- (void)setButtonBevelOpacity:(CGFloat)buttonBevelOpacity

0 commit comments

Comments
 (0)