detectar el envío de formularios UIWebView en XCode

I've read the posts here, but cannot quite adapt them to my needs. I have:

-(IBAction) abouthtml
{
NSString *urlAddress = [[NSBundle mainBundle] pathForResource:@"about" ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
CGRect webViewRect = frameWebSpace;
UIWebView *myWebPage=[[UIWebView alloc] initWithFrame:webViewRect];
[myWebPage loadRequest:requestObj];
[self.view addSubview:myWebPage];
}

This displays fine, but my "Return to Program" submit button in about.html is not working.

I've tried, as suggested in posts here:

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request 
navigationType:(UIWebViewNavigationType)navigationType 
{
if (navigationType == UIWebViewNavigationTypeFormSubmitted) 
{
     ....

But obviously, nothing links myWebPage to webView. Can someone suggest what I'm missing? Do I need to make webView a delegate of myWebPage? Confused, but hopeful...

preguntado el 30 de enero de 12 a las 19:01

2 Respuestas

you have to set the delegate of UIWebView to be the object that implements shouldStartLoadWithRequest, [myWebPage setDelegate:self], assuming that class that adds the subview is the one you want to receive the shouldStartLoadWithRequest mensaje

Respondido el 30 de enero de 12 a las 23:01

Kit myWebPage's delegate to the object that implements (in your case probably yo)

-webView:shouldStartLoadWithRequest:navigationType:

Respondido el 30 de enero de 12 a las 23:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.