From 3a9a10d29a862160d6e07c5aae7dda2377078e9d Mon Sep 17 00:00:00 2001 From: Felipe Cesar Date: Fri, 5 Aug 2016 12:16:29 +0200 Subject: [PATCH 1/2] Grammatical correction on method parameter. --- SVWebViewController/SVWebViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVWebViewController/SVWebViewController.m b/SVWebViewController/SVWebViewController.m index b9b2aea..d975204 100644 --- a/SVWebViewController/SVWebViewController.m +++ b/SVWebViewController/SVWebViewController.m @@ -304,7 +304,7 @@ - (void)actionButtonTapped:(id)sender { } } -- (void)doneButtonTapped:(id)sùender { +- (void)doneButtonTapped:(id)sender { [self dismissViewControllerAnimated:YES completion:NULL]; } From f2cb84873fb58a3145c51856a7197cead66390e0 Mon Sep 17 00:00:00 2001 From: Felipe Cesar Date: Fri, 5 Aug 2016 12:17:50 +0200 Subject: [PATCH 2/2] Implemented SVWebViewControllerDelegate, with callback "didPressDoneButton" --- SVWebViewController/SVModalWebViewController.m | 2 +- SVWebViewController/SVWebViewController.h | 6 +++++- SVWebViewController/SVWebViewController.m | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/SVWebViewController/SVModalWebViewController.m b/SVWebViewController/SVModalWebViewController.m index 83f2337..d7f1ac5 100644 --- a/SVWebViewController/SVModalWebViewController.m +++ b/SVWebViewController/SVModalWebViewController.m @@ -60,7 +60,7 @@ - (void)viewWillAppear:(BOOL)animated { #pragma mark - Delegate - (void)setWebViewDelegate:(id)webViewDelegate { - self.webViewController.delegate = webViewDelegate; + self.webViewController.delegate = (id)webViewDelegate; } - (id)webViewDelegate { diff --git a/SVWebViewController/SVWebViewController.h b/SVWebViewController/SVWebViewController.h index b41ce2c..c15c9aa 100644 --- a/SVWebViewController/SVWebViewController.h +++ b/SVWebViewController/SVWebViewController.h @@ -6,12 +6,16 @@ // // https://github.com/samvermette/SVWebViewController +@protocol SVWebViewControllerDelegate +-(void) didPressDoneButton; +@end + @interface SVWebViewController : UIViewController - (instancetype)initWithAddress:(NSString*)urlString; - (instancetype)initWithURL:(NSURL*)URL; - (instancetype)initWithURLRequest:(NSURLRequest *)request; -@property (nonatomic, weak) id delegate; +@property (nonatomic, weak) id delegate; @end diff --git a/SVWebViewController/SVWebViewController.m b/SVWebViewController/SVWebViewController.m index d975204..16b9ecf 100644 --- a/SVWebViewController/SVWebViewController.m +++ b/SVWebViewController/SVWebViewController.m @@ -305,7 +305,11 @@ - (void)actionButtonTapped:(id)sender { } - (void)doneButtonTapped:(id)sender { - [self dismissViewControllerAnimated:YES completion:NULL]; + [self dismissViewControllerAnimated:YES completion:^{ + if ([self.delegate respondsToSelector:@selector(didPressDoneButton)]) { + [self.delegate didPressDoneButton]; + } + }]; } @end