0
votes

I'm trying to launch a UIViewController when a table line is clicked...

The code is main view controller is ...

- (void)showDetail:(NSString *)detail
{
    DetailViewController *secondViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]]; 
    [self.navigationController pushViewController:secondViewController animated:YES];
    [DetailViewController release];

}

I filled in the viewDidLoad method in my "DetailViewController" class that is attached to the NIB.

- (void)viewDidLoad:(BOOL)animated;
{
    NSURL *url = [NSURL URLWithString:@"www.google.com"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
}

When I hit the pushViewController method, the NIB appears to load (can see a test label on it) but the viewDidLoad method is not called. In that method, I'm trying to load a test HTML into a UIWebView.

Any ideas?

1

1 Answers

0
votes

There is no event viewDidLoad: change to the bellow it should work.

- (void)viewDidLoad{
    NSURL *url = [NSURL URLWithString:@"www.google.com"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
}