Translucent Status Bars (iPhone/iPad/iPod Touch)
Asked Answered
P

2

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];
}
}
Plumlee answered 8/12, 2010 at 23:21 Comment(0)
A
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.

Anemometry answered 8/12, 2010 at 23:31 Comment(4)
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.Plumlee
You can't have a translucent status bar on the iPad.Penuchle
Yeah, I had hoped that was changed in the latest SDK. Looks like I'll be rolling my own then :PPlumlee
The BBC News iPad app has a translucent status bar when you play one of the videos.Sisely
E
2

Something like this?

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
Encyclopedic answered 8/12, 2010 at 23:24 Comment(1)
Unfortunately not. I'm using [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; and this seems to override any style setting in favor of black opaque. :(Plumlee

© 2022 - 2024 — McMap. All rights reserved.