Note that there are some explanatory texts on larger screens.

plurals
  1. POshouldStartLoadwithRequest not getting called in subclass
    primarykey
    data
    text
    <p>I have a view controlled app. On my xib I have no webviews but I do have buttons that bring up classes that have webviews. So hit button one and a uiwebview pops up so on and so forth. </p> <p>Now in one of my classes I pull up a remote webpage that has a link on it. I want to over-ride that button link with shouldStartLoadwithrequest. How ever this never seems to get called.</p> <p>Right now my class is called Tenth.m and I have this code in my view controller</p> <pre><code>- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { NSLog(@" Test spot 1"); NSString* scheme = [[request URL] scheme]; if ([@"didTap" isEqual:scheme]) { // Call your method NSLog(@" Test spot 2"); [self didTapButton1]; return NO; } else { NSLog(@" Test spot 3"); return YES; }} </code></pre> <p>But I get nothing (none of my NSLogs). I have tried putting this into my Tenth.m class and still nothing. I have looked at other examples and even downloaded one but it only uses the viewcontroller and delegates classes. No third class.</p> <p>I'm lost as to why its not getting called.</p> <p>Here is my third class</p> <pre><code>#import "Tenth.h" @implementation Tenth - (void)awakeFromNib { [category10 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.mywebsite.com/api/didtap.php"]]]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)dealloc { [super dealloc]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } #pragma mark - View lifecycle /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return YES; } @end </code></pre> <p>remote page code </p> <pre><code> &lt;a href="didTap://button1"&gt;hello&lt;/a&gt; </code></pre> <p>Tenth.h file</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface Tenth : UIViewController &lt;UIWebViewDelegate&gt; { IBOutlet UIWebView *category10; } -(IBAction)back; @end </code></pre>
    singulars
    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