I have a table view, when a row is selected it goes on to the detail view. In the detail view i have a button that passes a string to the the new view the new view is a webView, so it opens up a webpage. But in web view I have the navbar and when I press the back button I end up in the table view not the detail view. How can I change that so I go back to the detail view?
This is what I use to get to detail view
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CustomDrawingViewControllerA *drawingVC = [[CustomDrawingViewControllerA alloc] init];
drawingVC.viewTitle = [[tableView cellForRowAtIndexPath:indexPath] textLabel].text;
[self.navigationController pushViewController:drawingVC animated:YES];
This gets me from detailview to Webview via a button pressed
- (IBAction)onHelpButtonClicked:(id)sender
{
if (m_helpPopupViewController==nil)
{
m_helpPopupViewController =[[WebViewController alloc]
initWithNibName:@"WebViewController" bundle:nil];
m_helpPopupViewController.title2 = webAdd;
}
[self.view addSubview:m_helpPopupViewController.view];
This gets the Webview loaded
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSString *fullURL = @"http://www.systembolaget.se"; NSURL *url =
[NSURL URLWithString:fullURL]; NSURLRequest *requestObj
= [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj];
NSLog(@"test %@", title2);
}
You add webView as sub view of detail view controller, so web you tab the back button of navigation controller you come back to the previous view controller on the navigation stack that is the table view. To get what you want you should perform: