What is the difference of pushViewController line?


#1

Hi guys,
I have difficulty understand this line of code:

In ListViewController.m

if (![self splitViewController]) {
        [[self navigationController] pushViewController:webViewController
                                               animated:YES];
}

The reason is this line of code will make the web page (after I click 1 item in the list) appear on detail view(right view) only. However, without this line of code, the page will appear on master view(left view) only. I don’t understand this behavior because both master and detail view have a pointer to WebViewController, which is “wvc”. Therefore, my guess is the page should appear on both side if I don’t have the code above, the page should appear only on detail view (right view) if I have that line of code.

In NerdfeedAppDelegate.m

ListViewController *lvc = [[ListViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *masterNav = [[UINavigationController alloc]
                                         initWithRootViewController:lvc];
    
WebViewController *wvc = [[WebViewController alloc] init];
[lvc setWebViewController:wvc];
...

UINavigationController *detailNav = [[UINavigationController alloc]
                                             initWithRootViewController:wvc];

I really need to understand this, please answer if you know.
Thank you,