I'm writing an application based off of the Three20 framework, and I seem to be having some trouble...
I'm using the TTTableViewController to load data from an endpoint and display a list of the titles, which can be clicked to present a new UIViewController which contains a UIWebView that shows the URL (gotten from the JSON data). However, when I hit the "Back" button in the UIViewController, the view pops back...but the UIWebView doesn't disappear (it is defined with [autorelease]). It stays on top of where the TTTableView should be.
The code I use in SearchResultViewController to initialize the UIWebView is fairly straightforward:
- (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];
....
}
And the SearchResultViewController is pushed equally trivially:
- (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];
}