how to disable TTNavigator toolbar buttons?

248 views Asked by At

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...

1

There are 1 answers

0
aporat On BEST ANSWER

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]];