5

I've been looking around and it seems like the answer is no, but the posts are dated so I was wondering if this has changed. Is it possible to set the status bar to translucent? I'm trying to do a fade-in/fade-out effect on a multitouch tap but the status bar keeps coming up as solid black.

Thanks!

-- edit -- The code I'm using for the event transition is below. I have set the statusbar to translucent in the -info.plist, but I noticed there's no Black Translucent setting in IB (which is probably my answer: no translucent statusbar unless you're Apple.)

-(IBAction)showOptions:(id)sender
{
if ([UIApplication sharedApplication].statusBarHidden == YES) {
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
    [UIView beginAnimations:@"fadeIn" context:nil];
    [UIView setAnimationDuration:0.25];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    optionsView_portrait.alpha = 0.5;
    [UIView commitAnimations];
}
else
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    [UIView beginAnimations:@"fadeOut" context:nil];
    [UIView setAnimationDuration:0.25];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    optionsView_portrait.alpha = 0.0;
    [UIView commitAnimations];
}
}
bens951
  • 15
  • 3
Eric
  • 2,061
  • 8
  • 28
  • 37

2 Answers2

14

Set the status bar style of UIApplication:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent
                                            animated:YES];

The view of the view controller where the status bar is translucent should also occupy the entire screen dimensions of 320 by 480 points. This way, the view underlaps the status bar and anything in the top 20 pixels will be semi-visible under the status bar.

If there isn't any part of your view occupying the top 20 pixels it will show up as black underneath.

EDIT: If you are working with the iPad, as Steven Fisher points out the iPad does not support having a translucent black status bar. It's always solid black.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
  • Yes, everything is set up so that it will have content behind it once I'm able to get it to be translucent. Unfortunately this method isn't doing anything either. I notice you mention the dimensions of 320 by 480, in reference to iPhone/iPod Touch. I haven't worked on that part of the app yet since the primary (possibly only) device to use this is the iPad. – Eric Dec 09 '10 at 00:29
  • 2
    You can't have a translucent status bar on the iPad. – Steven Fisher Dec 09 '10 at 05:57
  • Yeah, I had hoped that was changed in the latest SDK. Looks like I'll be rolling my own then :P – Eric Dec 09 '10 at 16:07
  • The BBC News iPad app has a translucent status bar when you play one of the videos. – aeldron Sep 16 '11 at 17:01
2

Something like this?

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
James J
  • 6,428
  • 6
  • 35
  • 45
  • Unfortunately not. I'm using [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; and this seems to override any style setting in favor of black opaque. :( – Eric Dec 08 '10 at 23:32