Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Demo/Classes/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
3 changes: 3 additions & 0 deletions SVWebViewController/SVModalWebViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 11 additions & 1 deletion SVWebViewController/SVModalWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions SVWebViewController/SVWebViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
- (instancetype)initWithURL:(NSURL*)URL;
- (instancetype)initWithURLRequest:(NSURLRequest *)request;

@property (nonatomic, assign, getter=toolBarHidden) BOOL toolBarHidden;

@end
4 changes: 3 additions & 1 deletion SVWebViewController/SVWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Expand Down