views:

84

answers:

2

How can I make the main content view of my app full screen, and show the toolbar only when the user touches the screen and one more touch will hide the toolbar? kind of like the ibooks app?

also how do I make a toolbar transparent?

A: 

To make content view of your app full screen just set [[UIApplication sharedApplication] setStatusBarHidden:YES];

To hide/show : Identify the tap area of status bar when clicked set - [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];.

To make it transparent use [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

Chandan Shetty SP
"To hide/show : Identify the tap area of status bar " How can the user touch any where on the screen and trigger the toolbar?
Yolanda
Status bar area is StatusBarRect = CGRectMake(0,0,320,22) in portrait mode.. if it is landscape StatusBarRect = CGRectMake(0,0,480,22).. And in touchesEnded method you can check whether user tapped on statusBarRect area or not.
Chandan Shetty SP
A: 

Out of interest, are you using a UIWebView? Because that makes life more tricky, because you need to detect tap views to the UIWebView. There are four main ways of doing this.

  1. Subclass UIWebView. Not recommended because Apple tell you not to do this.
  2. Subclass UIWindow. I found this to work very well - until I needed to rotate to landscape, which it wouldn't let me do! I'm still trying to find a solution to this. In any case, see http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/ .
  3. Something about putting a transparent UIView on top of the UIWebView, but I think this also involves subclassing and is not recommended. I have never tried this.
  4. Use a slightly hacky Javascript detection through the webpage to send messages to the UIWebView (through changing document.location in the javascript, then intercepting the URL request through the Objective-C code, denying access, and using it to do the things which Chandan Shetty SP suggests above.

However, if you are not using a UIWebView, this post is irrelevant.

Helen