Skip to content

Commit 2263810

Browse files
committed
add property(toolbarHidden).
1 parent a27be37 commit 2263810

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Pod/Classes/M2DWebViewController/M2DWebViewController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ typedef NS_ENUM(NSUInteger, M2DWebViewType) {
2222

2323
@interface M2DWebViewController : UIViewController <WKUIDelegate, WKNavigationDelegate, UIWebViewDelegate>
2424

25-
@property (assign, nonatomic) BOOL smoothScroll;
25+
@property (nonatomic, assign) BOOL toolbarHidden;
26+
@property (nonatomic, assign) BOOL smoothScroll;
2627
@property (nonatomic, readonly) id webView;
2728
@property (nonatomic, copy) void (^actionButtonPressedHandler)(NSString *pageTitle, NSURL *url);
2829

Pod/Classes/M2DWebViewController/M2DWebViewController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ - (void)viewDidLoad
132132
- (void)viewWillAppear:(BOOL)animated
133133
{
134134
[super viewWillAppear:animated];
135-
[self.navigationController setToolbarHidden:NO animated:YES];
135+
[self.navigationController setToolbarHidden:self.toolbarHidden animated:YES];
136136
if (goBackButton_ == nil) {
137137
NSArray *toolbarItems = nil;
138138
goBackButton_ = [[UIBarButtonItem alloc] initWithImage:self.backArrowImage ?: [UIImage m2d_arrowIconWithDirection:M2DArrowIconDirectionLeft size:M2DArrowIconSize] style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
@@ -170,6 +170,12 @@ - (void)setSmoothScroll:(BOOL)smoothScroll
170170
}
171171
}
172172

173+
- (void)setToolbarHidden:(BOOL)toolbarHidden
174+
{
175+
_toolbarHidden = toolbarHidden;
176+
[self.navigationController setToolbarHidden:self.toolbarHidden animated:YES];
177+
}
178+
173179
#pragma mark - WKUIDelegate
174180

175181
//- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures

0 commit comments

Comments
 (0)