0

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);

  }
4

1 回答 1

0

您将 webView 添加为详细视图控制器的子视图,因此您使用 Web 选项卡导航控制器的后退按钮,您将返回到导航堆栈上的前一个视图控制器,即表格视图。要得到你想要的,你应该执行:

[self.navigationController pushViewController:webView animated:YES];
于 2012-04-06T09:21:21.323 回答