tags:

views:

223

answers:

0

HI I have created a NSMutablArray and add 8 objects to it in the RootViewController. I am displaying the array in the tableview. Whenever i click on the cell with a certain name, i want to pass a URL to the webview which is currently part of anothe DetailViewController.

here is some code that i am trying to make it work from rootViewController NSString *selectCompany = [listOfItems objectAtIndex:indexPath.row];

DetailViewController *dvView = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];

if (selectCompany = "Nihilent") {

dvView.selectedCompany = @"http://www.nihilent.com";

}else if (selectCompany = "TCS") {

dvView.selectedCompany = @"http://www.tcs.com";

Following code i have written in DetailViewController for the webview - (void)viewDidLoad { [super viewDidLoad];

self.navigationItem.title = @"selected Company";

NSLog(selectedCompany); webView.userInteractionEnabled = true; [webView loadRequest:[[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"selectedCompany"]]];

[self.navigationController pushViewController:webView animated:YES]; // [self.navigationController setView:webView]; [webView release];

}

The view loads currently whenever i select the cell, but the corresponding URL is never passed to the webView object and displayed in webview.

please can someone guide me here and let me know how can i get this thing to work.