Note that there are some explanatory texts on larger screens.

plurals
  1. POWebView not responding when called from a method
    primarykey
    data
    text
    <p>I have an app with tabbar and webview. I'm trying to make the app come back to default url each time user taps the bar. Right now I'm intercepting taps and launching a method, however it's not affecting my webview (it's not loading the page). The method works properly when called from the class, but not when it's called from my app delegate, where I'm intercepting taps.</p> <p>I suspect it's something with the way I create the SecondViewController object that it's not pointing to the webview, but I have no clue what I'm doing wrong.</p> <p>Here is the code:</p> <p>Second view header (where the WebView is located)</p> <pre><code>@interface SecondViewController : UIViewController { IBOutlet UIWebView *secondView; } - (void) goToPage; </code></pre> <p>Second view implementation</p> <pre><code>#import "SecondViewController.h" @implementation SecondViewController - (void)awakeFromNib { [self goToPage]; } - (void) goToPage { NSLog(@"go to page"); NSString *newURL = [NSString stringWithFormat:@"http://pageurl"]; [secondView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:newURL]]]; } </code></pre> <p>My app delegate, where I call the SecondViewController class method:</p> <pre><code>#import "RedDragonAppDelegate.h" #import "SecondViewController.h" @implementation RedDragonAppDelegate @synthesize window; @synthesize rootController; - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [window addSubview:rootController.view]; } - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { NSLog(@"didSelectViewController %d", rootController.selectedIndex); SecondViewController * sv = [[SecondViewController alloc] init]; if (rootController.selectedIndex == 0){ //NSLog(@"if in didSelectViewController 0"); } else if (rootController.selectedIndex == 1) { //NSLog(@"if in didSelectViewController 1"); [sv goToPage]; } } </code></pre> <p>Thanks fot your help!</p>
    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