Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e1653a

Browse files
Merge pull request #119 from sebastianbaar/master
Implement a 'didFailLoadWithError' block
2 parents 932d87a + cd6f44a commit 0e1653a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎TOWebViewController/TOWebViewController.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@
168168
*/
169169
@property (nonatomic,copy) BOOL (^shouldStartLoadRequestHandler)(NSURLRequest *request, UIWebViewNavigationType navigationType);
170170

171+
/**
172+
An optional block that when set, will be triggered if the web view failed to load a frame.
173+
*/
174+
@property (nonatomic,copy) void (^didFailLoadWithErrorRequestHandler)(NSError *error);
175+
171176
/**
172177
An optional block that when set, will be triggered each time the web view has finished a load operation.
173178
*/

‎TOWebViewController/TOWebViewController.m‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,13 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
794794
return shouldStart;
795795
}
796796

797+
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
798+
{
799+
//If a request handler has been set, check to see if we should go ahead
800+
if (self.didFailLoadWithErrorRequestHandler)
801+
return self.didFailLoadWithErrorRequestHandler(error);
802+
}
803+
797804
- (void)webViewDidStartLoad:(UIWebView *)webView
798805
{
799806
//show that loading started in the status bar

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /