0
votes

I would like my status bar to be black and be 25% transparent. I understand that the status bar is transparent by default, and therefore takes on the color of the background. However when I set the views backgroundColor:

self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.75f];

The status bar is completely black.

I have a toolbar which I set to black with an alpha of .75 and I am just trying to get them to match:

self.toolBar.tintColor = [UIColor whiteColor];
self.toolBar.barTintColor = [UIColor blackColor];
self.toolBar.alpha = .75f;

Any reason why the background color on the UIView is not respecting the alpha component?

enter image description here

EDIT:

Based on comment that view does not underlap the status bar. If I set background to green it shows that it works:

enter image description here

However if I start to add transparency to the green color, it does not get lighter it gets darker. Seems like the default is to be black underneath my only UIView, not white.

self.view.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:.25];

enter image description here

1

1 Answers

1
votes

The status bar in iOS 7 is completely transparent. The problem may be that your view and the toolbar are not correctly underlapping the status bar. So you are seeing the black window behind it. (Or, in fact, you may setting the size of the window incorrectly, in which case you are seeing nothing at all behind the status bar.)

If the view does underlap the status bar, then you need to set the bar positioning of the toolbar to Top Attached so that its height increases up underneath the status bar. We should not be seeing a separate color for the status bar; it should appear to overlay your interface, lying in front of the top of the toolbar.