iPhone-SDK: pushViewController doesn't push UIWebView?



I have TabBarView Controller, where i keep four tab bar items, let sat item1, item2, item3 and item 4. When clicking on item2 tab bar item, i call a RootViewController where it has a Navigation controller with a TableView and shows the row items. Upto here it is fine. When clicking on a row item, will have to launch a UIWebView to show the content.

I did code like below for this process.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

 navigationController = [[UINavigationController alloc] init];
 webViewController = [[WebViewController alloc] init];
 [[self navigationController] pushViewController:webViewController animated:NO];
 [webViewController release];


The problem now is, clicking on a row item is not pushing the UIWebView code at all. I tested the UIWebView code with normal addSubView method like "[appDelegate.window addSubview:webViewController.view];" instead of calling via pushViewController. It is calling UIWebView and shows the web content successfully. I understand the problem should be calling as pushViewController:webViewController.

Can anyone point me what are the ways that it should be not be worked in this case and how can i correct it to make it work with pushViewController itself? I need to call UIWebView only using pushViewController. For such all these combination, is there any sample source available?

Waiting for someone's help.



  • Is WebViewController a UIViewController subclass? Does it have a nib file associated?

    pgb11 сентября 2009, 12:37

1 ответов


I think you are mistakenly creating a new navigation controller here

navigationController = [[UINavigationController alloc] init];

remove that line and use

[self.navigationController pushViewController:webViewController animated:NO];

instead of your reference above. That should do it :-)

  • Thanks for the reply. I found the problem of mine and resolved already, which is nothing but, i didn’t set my particular controller class as ‘Navigation’ in I.B in Tab Bar Controller Attributes properties.

    13 сентября 2009, 16:51