diff --git a/Demo/Classes/ViewController.m b/Demo/Classes/ViewController.m index a074f4d..7097b76 100644 --- a/Demo/Classes/ViewController.m +++ b/Demo/Classes/ViewController.m @@ -24,6 +24,10 @@ - (void)presentWebViewController { NSURL *URL = [NSURL URLWithString:@"http://samvermette.com"]; SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithURL:URL]; webViewController.modalPresentationStyle = UIModalPresentationPageSheet; + webViewController.barsTintColor = [UIColor whiteColor]; + webViewController.barsTranslucent = NO; + webViewController.barsStyle = UIBarStyleBlack; + webViewController.toolBarHidden = YES; [self presentViewController:webViewController animated:YES completion:NULL]; } diff --git a/SVWebViewController/SVModalWebViewController.h b/SVWebViewController/SVModalWebViewController.h index c8ff5ca..0fb098f 100644 --- a/SVWebViewController/SVModalWebViewController.h +++ b/SVWebViewController/SVModalWebViewController.h @@ -15,5 +15,8 @@ - (instancetype)initWithURLRequest:(NSURLRequest *)request; @property (nonatomic, strong) UIColor *barsTintColor; +@property (nonatomic, assign, getter=isBarsTranslucent) BOOL barsTranslucent; +@property (nonatomic, assign) UIBarStyle barsStyle; +@property (nonatomic, assign, getter=toolBarHidden) BOOL toolBarHidden; @end diff --git a/SVWebViewController/SVModalWebViewController.m b/SVWebViewController/SVModalWebViewController.m index 38cfd13..dbf4aed 100644 --- a/SVWebViewController/SVModalWebViewController.m +++ b/SVWebViewController/SVModalWebViewController.m @@ -54,7 +54,17 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:NO]; self.webViewController.title = self.title; - self.navigationBar.tintColor = self.barsTintColor; + self.navigationBar.translucent = self.barsTranslucent; + self.navigationBar.barStyle = self.barsStyle; +} + +- (void)setBarsTintColor:(UIColor *)barsTintColor { + self.navigationBar.tintColor = barsTintColor; +} + +- (void)setToolBarHidden:(BOOL)toolBarHidden +{ + self.webViewController.toolBarHidden = toolBarHidden; } @end diff --git a/SVWebViewController/SVWebViewController.h b/SVWebViewController/SVWebViewController.h index ccd90bf..23219a1 100644 --- a/SVWebViewController/SVWebViewController.h +++ b/SVWebViewController/SVWebViewController.h @@ -12,4 +12,6 @@ - (instancetype)initWithURL:(NSURL*)URL; - (instancetype)initWithURLRequest:(NSURLRequest *)request; +@property (nonatomic, assign, getter=toolBarHidden) BOOL toolBarHidden; + @end diff --git a/SVWebViewController/SVWebViewController.m b/SVWebViewController/SVWebViewController.m index 2714aaf..a0f6183 100644 --- a/SVWebViewController/SVWebViewController.m +++ b/SVWebViewController/SVWebViewController.m @@ -82,7 +82,7 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - [self.navigationController setToolbarHidden:NO animated:animated]; + [self.navigationController setToolbarHidden:self.toolBarHidden animated:animated]; } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { [self.navigationController setToolbarHidden:YES animated:animated]; @@ -193,6 +193,7 @@ - (void)updateToolbarItems { toolbar.items = items; toolbar.barStyle = self.navigationController.navigationBar.barStyle; toolbar.tintColor = self.navigationController.navigationBar.tintColor; + toolbar.translucent = self.navigationController.navigationBar.translucent; self.navigationItem.rightBarButtonItems = items.reverseObjectEnumerator.allObjects; } @@ -211,6 +212,7 @@ - (void)updateToolbarItems { self.navigationController.toolbar.barStyle = self.navigationController.navigationBar.barStyle; self.navigationController.toolbar.tintColor = self.navigationController.navigationBar.tintColor; + self.navigationController.toolbar.translucent = self.navigationController.navigationBar.translucent; self.toolbarItems = items; } }