Note that there are some explanatory texts on larger screens.

plurals
  1. POTTNavigator not pushing onto navigation stack
    text
    copied!<p>I am using the TTTableView class from the Three20 framework to create table view cells with styled content, including HTML with URLs. The cells look and work almost fine. The URL are picked up, and tapping on one of the fire the appropriate delegate method. However, the URL is open in a TTWebController the TTWebController does not have a back arrow to pop the view of the navigation stack. </p> <p>Heres my code:</p> <pre><code>TTTableStyledTextItem *messageItem = [TTTableStyledTextItem itemWithText:[TTStyledText textFromXHTML:message lineBreaks:YES URLs:YES]]; messageItem.delegate = self; TTListDataSource *dataSource = [[TTListDataSource alloc] init]; [dataSource.items addObject:messageItem]; TTNavigator* navigator = [TTNavigator navigator]; navigator.delegate = self; navigator.window = [UIApplication sharedApplication].delegate.window; TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; self.tableView.dataSource = dataSource; self.tableView.delegate = self; </code></pre> <p>The URLs are highlighted in the cells and tapping one fires this method:</p> <pre><code>- (BOOL)navigator: (TTBaseNavigator *)navigator shouldOpenURL:(NSURL *) URL { return YES; </code></pre> <p>}</p> <p>The TTWebController does not seem to be pushed onto the navigation stack, it is just "shown" without a back arrow. Any thoughts?</p> <p><strong>Update with my solution</strong> After playing around some more I think the problem is is that I am trying to use the Three20 URL navigation method to push a new view controller while at the same time using a regular iOS UINavigationController. The point at which the TTWebcontroller is being shown is the first view controller on the Three20 navigation stack, and as such is the root view controller and so does not have any notion of "going back" to a previous view. </p> <p>Here is my work around:</p> <pre><code>- (BOOL)navigator: (TTBaseNavigator *)navigator shouldOpenURL:(NSURL *) URL { // setup a webcontroller with the URL and push it TTWebController *webController = [[TTWebController alloc] init]; [webController openURL:URL]; [self.navigationController pushViewController:webController animated:YES]; [webController release]; // dont navigate with TTBaseNavigator // this does not use the regular UINavigation stack and // ... the new view becomes rootview and has no back button return NO; } </code></pre> <p>Hope this helps some one. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload