3

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...

2 Answers 2

1

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 message

Sign up to request clarification or add additional context in comments.

Comments

0

Set myWebPage's delegate to the object that implements (in your case probably self)

-webView:shouldStartLoadWithRequest:navigationType:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.