Three20 フレームワークに基づいてアプリケーションを作成していますが、問題が発生しているようです...
TTTableViewController を使用して、エンドポイントからデータをロードし、タイトルのリストを表示します。これをクリックすると、URL (JSON データから取得) を表示する UIWebView を含む新しい UIViewController を表示できます。しかし、UIViewController で「戻る」ボタンを押すと、ビューが元に戻りますが、UIWebView は消えません ([autorelease] で定義されています)。TTTableView があるべき場所の上にとどまります。
UIWebView を初期化するために SearchResultViewController で使用するコードは非常に単純です。
- (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];
}