Permalink
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...
1 parent 633cf04 commit 4570705d11de9337f05c26ceb267c3877bd5ac43 jinthagerman committed Dec 23, 2012
@@ -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
@@ -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 {
@@ -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];
}

0 comments on commit 4570705

Please sign in to comment.