views:

28

answers:

1

hi,

I have a uiwebview in a navigation bar which is in turn inside a tabbar item. I want to know how to hide the tabbar and navigation bar the moment the user takes off his finger from the screen just like hiding the toolbar in the default photos app in the iPhone.

I should also be able to show the tabbar and the navigation bar when i touch my uiwebview again.

A: 

By default, a UIWebViewDelegate is not equipped to receive touch events... however, if you subclassed the UIWebView as UIControl (which can accept touch events), you could link the UIWebView's touchUpInside: method provided by UIControl to code that hides the navigation bar.

To hide the navigation bar, you could use:

[self.navigationController setNavigationBarHidden:YES animated:YES];

Then, you could use similar UIControl implementation do detect when a finger has left the UIWebView, etc.

Chromium
Unfortunately, not even subclassing UIWebView will help. See this question: http://stackoverflow.com/questions/990870/handling-touches-inside-uiwebview
Brian
Thanks Brian- didn't know about that. Looks like this is a better way: http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/
Chromium