Permalink
Browse files

Add option to disable toolbar in SSWebViewController

  • Loading branch information...
1 parent 7e6cfe5 commit 123b3d5a20476e9bdf869521764f2543171cf60f @soffes committed Apr 20, 2013
Showing with 19 additions and 3 deletions.
  1. +1 −0 SSToolkit/SSWebViewController.h
  2. +18 −3 SSToolkit/SSWebViewController.m
@@ -12,6 +12,7 @@
@interface SSWebViewController : UIViewController <SSWebViewDelegate, UIActionSheetDelegate, MFMailComposeViewControllerDelegate>
+@property (nonatomic, assign) BOOL useToolbar;
@property (nonatomic, readonly, copy) NSURL *currentURL;
- (void)loadURL:(NSURL *)url;
@@ -30,6 +30,16 @@ - (void)emailURL:(id)sender;
@implementation SSWebViewController
+#pragma mark - NSObject
+
+- (id)init {
+ if ((self = [super init])) {
+ _useToolbar = YES;
+ }
+ return self;
+}
+
+
#pragma mark - UIViewController
- (void)viewDidLoad {
@@ -102,15 +112,18 @@ - (void)viewDidLoad {
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- if (![_url isFileURL]) {
+ if (_useToolbar && ![_url isFileURL]) {
[self.navigationController setToolbarHidden:NO animated:animated];
}
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [self.navigationController setToolbarHidden:YES animated:animated];
+
+ if (_useToolbar) {
+ [self.navigationController setToolbarHidden:YES animated:animated];
+ }
}
@@ -241,7 +254,9 @@ - (void)webViewDidStartLoadingPage:(SSWebView *)aWebView {
self.title = url.absoluteString;
[self _updateBrowserUI];
- [self.navigationController setToolbarHidden:[url isFileURL] animated:YES];
+ if (_useToolbar) {
+ [self.navigationController setToolbarHidden:[url isFileURL] animated:YES];
+ }
}

0 comments on commit 123b3d5

Please sign in to comment.