首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TTNavigator不推到导航堆栈

TTNavigator不推到导航堆栈
EN

Stack Overflow用户
提问于 2012-01-07 16:30:24
回答 1查看 371关注 0票数 0

我正在使用来自TTTableView框架的Three20类来创建带有样式内容的表视图单元格,包括带有URL的HTML。细胞看起来和工作几乎都很好。获取URL,并点击适当的委托方法之一。但是,URL是在TTWebController中打开的-- TTWebController没有反箭头来弹出导航堆栈的视图。

这是我的代码:

代码语言:javascript
复制
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;

在单元格中突出显示URL,并点击一个单元格触发此方法:

代码语言:javascript
复制
- (BOOL)navigator: (TTBaseNavigator *)navigator shouldOpenURL:(NSURL *) URL {
return YES;

}

TTWebController似乎没有被推到导航堆栈上,它只是“显示”而没有反箭头。有什么想法吗?

更新了我的解决方案之后,我想问题是我正在尝试使用Three20 URL导航方法来推送一个新的视图控制器,同时使用一个常规的iOS UINavigationController。显示TTWebcontroller的点是Three20导航堆栈上的第一个视图控制器,其本身就是根视图控制器,因此没有任何“返回”以前视图的概念。

这是我的工作:

代码语言:javascript
复制
- (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;
}

希望这能帮上忙。

EN

回答 1

Stack Overflow用户

发布于 2012-01-07 20:25:34

这可能会发生,这取决于您如何显示包含viewController的tableView。viewController将其推到UINavigationController上或按url调用(在这种情况下,Three20将自动为您创建navigationController )。

您需要确保可以将navigationController和WebController一起推送到上面。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8771176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档