如何禁用 TTNavigator 工具栏按钮?

发布于 2024-12-08 23:02:31 字数 274 浏览 4 评论 0原文

请参考我的这篇文章 - 如何更改 TTNavigator (对于网页网址)底部栏颜色?

现在我必须禁用同一控制器的“在 Safari 中打开”选项。请给我建议一个方法。我还无法找到使用样式来做到这一点。我知道这是可能的,因为我在几个应用程序上看到过这个选项。

请帮忙...

Please refer my this post- how to change TTNavigator (for a web url) bottom bar color?

now i have to disable 'Open In Safari' option to the same controller. Please suggest me a way. I was unable to find to do this using styles yet. I know it is possible because i have seen the option on few apps.

Please help...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界和平 2024-12-15 23:02:31

默认情况下,TTNavigator 会将任何不匹配的 URL 转发给 TTWebController。

因此,如果您想更改 Web 视图,则必须将 TTWebController 子类化为您自己的类,并在应用程序委托中添加映射:

要删除在 safar 操作按钮中打开,请尝试将此函数添加到您子类化的自定义 TTWebController 中:

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)loadView {
  [super loadView];

   TT_RELEASE_SAFELY(_toolbar);

   _toolbar = [[UIToolbar alloc] initWithFrame:
              CGRectMake(0, self.view.height - TTToolbarHeight(),
                         self.view.width, TTToolbarHeight())];
  _toolbar.autoresizingMask =
  UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
  _toolbar.tintColor = TTSTYLEVAR(toolbarTintColor);
  _toolbar.items = [NSArray arrayWithObjects:
                    _backButton,
                    space,
                    _forwardButton,
                    space,
                    _refreshButton,
                    nil];
  [self.view addSubview:_toolbar];

在您的应用程序委托中包含包罗万象的映射规则:

    [map from:@"*" toViewController:[CustomWebController class]];

by default, TTNavigator will forward any URLs it doesn't match to TTWebController.

So if you want to change the web view, you will have to subclass TTWebController to your own class, and add the mapping in the app delegate:

To remove the open in safar action button, try adding this function to your custom TTWebController you subclass:

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)loadView {
  [super loadView];

   TT_RELEASE_SAFELY(_toolbar);

   _toolbar = [[UIToolbar alloc] initWithFrame:
              CGRectMake(0, self.view.height - TTToolbarHeight(),
                         self.view.width, TTToolbarHeight())];
  _toolbar.autoresizingMask =
  UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
  _toolbar.tintColor = TTSTYLEVAR(toolbarTintColor);
  _toolbar.items = [NSArray arrayWithObjects:
                    _backButton,
                    space,
                    _forwardButton,
                    space,
                    _refreshButton,
                    nil];
  [self.view addSubview:_toolbar];

}

And include the catch-all mapping rule in your app delegate:

    [map from:@"*" toViewController:[CustomWebController class]];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文