gresrun / GHSidebarNav

A clone of the new Facebook iOS UI paradigm
Apache License 2.0
607 stars 136 forks source link

Reload View #28

Closed mcodo closed 11 years ago

mcodo commented 11 years ago

Hi In my app Im using the sidebar menu to open a viewcontroller with a webview. I'm passing the URL on click. But if i follow a link inside the webview, and then click on a menuline in the sidebar, it just opens the same (last) page in the webview.... How can I force the webview back to the original URL when clicking the sidebar? Or just reload the viewcontroller?

gresrun commented 11 years ago

I'd try calling loadRequest: on the UIWebView with the desired URL in viewWillAppear of the view controller.

mcodo commented 11 years ago

Thanks dude :) That worked like a charm. Ended up with this:

- (void) viewDidAppear:(BOOL)animated {
    GHAppDelegate *appDelegate = (GHAppDelegate *) [[UIApplication sharedApplication] delegate];
    NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"%@/mobileV2%@",appDelegate.baseURL,InnURL]];
    NSURLRequest *nsrequest=[NSURLRequest requestWithURL:url];
    [webview loadRequest:nsrequest];
}