I want to use UIWebView in the console, so I define a delegate:
@interface webViewDelegate : NSObject <UIWebViewDelegate>
and write the protocol:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
- (void)webViewDidStartLoad:(UIWebView *)webView;
- (void)webViewDidFinishLoad:(UIWebView *)webView;
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;
and then loadRequest:
webView = [[UIWebView alloc] init];
webView.delegate = WVdelegate;
NSURL *htmlURL = [NSURL URLWithString:@"http://192.168.0.100"];
NSURLRequest *request = [NSURLRequest requestWithURL:htmlURL];
[webView loadRequest:request];
The problem is that this is a console, and I want to finish the console after the delegate has been invoked. What should I do to wait for the delegate after calling loadRequest
?
You can get HTML source in console: