我有一个表视图,当选择一行时,它会进入详细视图。在详细视图中,我有一个按钮,将字符串传递给新视图,新视图是webView,因此它打开了一个网页。但是在Web视图中我有导航栏,当我按下后退按钮时,我最终在表视图中而不是详细视图。我该如何更改,以便返回详细视图?
这是我用来获取详细视图的内容
- (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];
通过按下按钮,我从详细视图到Webview
- (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];
这会加载Webview
- (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);
}
答案 0 :(得分:0)
您将webView添加为详细视图控制器的子视图,因此您可以选择导航控制器的后退按钮,然后返回到作为表视图的导航堆栈上的上一个视图控制器。为了得到你想要的东西你应该执行:
[self.navigationController pushViewController:webView animated:YES];