TTTableView隐藏返回TTTableViewController

问题描述:

我写的基于断Three20框架的应用程序,我似乎遇到了一些麻烦之后...TTTableView隐藏返回TTTableViewController

我使用TTTableViewController从端点加载数据和显示标题列表,可以单击它以呈现包含显示URL(从JSON数据获取)的UIWebView的新UIViewController。但是,当我点击UIViewController中的“返回”按钮时,视图弹出回来......但UIWebView不会消失(它是用[autorelease]定义的)。它停留在TTTableView应该在的位置之上。

我SearchResultViewController用于初始化一个UIWebView的代码是相当简单:

- (void)loadView { 
    .... 
    // Add the UIWebView 
    webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0.f, TT_ROW_HEIGHT + 20, TTApplicationFrame().size.width, TTApplicationFrame().size.height - TT_ROW_HEIGHT - toolbar.frame.size.height)] autorelease]; 
    // Load the URL 
    address = self.productIdentifier; 
    NSURL *url = [NSURL URLWithString:address]; 
    NSLog(@"%@",url); 
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 
    [webView loadRequest:requestObj]; 

    [self.navigationController.view addSubview:webView]; 
    .... 
} 

而且SearchResultViewController推同样平凡:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Search Again" style:UIBarButtonItemStylePlain target:self action:@selector(goBack)]; 
    self.navigationItem.backBarButtonItem = backButton; 
    [backButton release]; 

    SearchResultViewController *srvc = [[SearchResultViewController alloc] init]; 
    srvc.productIdentifier = [[[(id<SearchResultsModel>)self.model results] objectAtIndex:indexPath.row] url]; 
    srvc.title    = [[[(id<SearchResultsModel>)self.model results] objectAtIndex:indexPath.row] title]; 
    srvc.hidesBottomBarWhenPushed = YES; 
    [self.navigationController pushViewController:srvc animated: YES]; 
} 

想通了;可笑的愚蠢的错误。我将UIWebView添加到整个navigationController中,而不是我需要的视图中。Duh!