0

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

Community
  • 1
  • 1
Vaibhav Saran
  • 12,848
  • 3
  • 65
  • 75
  • you mean the TTWebController's toolbar? – aporat Oct 12 '11 at 15:57
  • am i confused? I'm not using "TTWebViewController" anywhere. What I am using is- TTNavigator* navigator = [TTNavigator navigator]; navigator.supportsShakeToReload = YES; navigator.persistenceMode = TTNavigatorPersistenceModeAll; [navigator openURLAction:[[TTURLAction actionWithURLPath:@"http://www.google.com"] applyAnimated:YES]]; to open a website and this simply opens a website in safari look a like webview. Shall i use "TTWebViewController" for this? Please elaborate... – Vaibhav Saran Oct 13 '11 at 16:08

1 Answers1

2

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]];
aporat
  • 5,922
  • 5
  • 32
  • 54