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...
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With