Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added backgroundImage property to SVModalWebViewController

This is used to set its navigationBar backgroundImage and this is in
turn used to set the toolbar backgroundImage
  • Loading branch information...
commit 4570705d11de9337f05c26ceb267c3877bd5ac43 1 parent 633cf04
@jinthagerman jinthagerman authored
View
1  SVWebViewController/SVModalWebViewController.h
@@ -26,6 +26,7 @@ typedef NSUInteger SVWebViewControllerAvailableActions;
- (id)initWithURL:(NSURL *)URL;
@property (nonatomic, strong) UIColor *barsTintColor;
+@property (nonatomic, strong) UIImage *barsBackgroundImage;
@property (nonatomic, readwrite) SVWebViewControllerAvailableActions availableActions;
@end
View
1  SVWebViewController/SVModalWebViewController.m
@@ -39,6 +39,7 @@ - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:NO];
self.navigationBar.tintColor = self.barsTintColor;
+ [self.navigationBar setBackgroundImage:self.barsBackgroundImage forBarMetrics:UIBarMetricsDefault];
}
- (void)setAvailableActions:(SVWebViewControllerAvailableActions)newAvailableActions {
View
7 SVWebViewController/SVWebViewController.m
@@ -238,6 +238,13 @@ - (void)updateToolbarItems {
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, toolbarWidth, 44.0f)];
toolbar.items = items;
toolbar.tintColor = self.navigationController.navigationBar.tintColor;
+
+ if ([self.navigationController.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault]) {
+ [toolbar setBackgroundImage:[self.navigationController.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault]
+ forToolbarPosition:UIToolbarPositionAny
+ barMetrics:UIBarMetricsDefault];
+ }
+
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:toolbar];
}
Please sign in to comment.
Something went wrong with that request. Please try again.