Note that there are some explanatory texts on larger screens.

plurals
  1. POi want navigate to another file in webview.
    primarykey
    data
    text
    <p>i want to call objective c file from javascript.</p> <pre><code>- (void)viewDidLoad { webview.delegate = self; myButton.enabled = NO; NSString *path=[[NSBundle mainBundle]pathForResource:@"1" ofType:@"html" inDirectory:@"files"]; NSURL *url=[NSURL fileURLWithPath:path]; NSURLRequest *request=[NSURLRequest requestWithURL:url]; [webview loadRequest:request];} </code></pre> <p>i am using this code to call my html page successfully and i use the below code to call shouldStartLoadWithRequest method in objective c.</p> <pre><code>&lt;a href="didTap://button1"&gt;&lt;img src="cercle24px.png" /&gt;&lt;/a&gt; </code></pre> <p>now i went to call new TestViewController.m file how to i call this file, i used the below code.its print the nslog correctly and give alert box also.but doesn't navigate to next file.please help me if any one know.i am waiting for your valuable reply please.</p> <pre><code> - (BOOL)webView:(UIWebView*)webview shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { NSLog(@"what"); UIAlertView *tstAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"Allowed only alphabets and numeric" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok",nil]; [tstAlert show]; NSString *absoluteUrl = [[request URL] absoluteString]; NSLog(@"absolute%@",absoluteUrl); if ([absoluteUrl isEqualToString:@"didtap://button1"]) { NSLog(@"yes"); TestViewController *testview=[[TestViewController alloc]initWithNibName:@"TestViewController" bundle:nil]; [self.navigationController pushViewController:testview animated:YES]; return NO; } NSLog(@"no"); return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload