When transparent status bar makes the view 20pixels lower after camera, iPhone

Status bar is important and should be there if it’s not a game. We usually use transparent black style (alpha of 0.5) status bar so it could fit in with the design style we make.

But as you might know, using transparent status bar has some problem when you’re bringing in some modal view from outside such as taking a photo or picking one from photo library. When it’s gone, whole view goes 20pixels down which makes the status bar just black thick one.

Here’s the solution of how we can solve such problem.

Before you dismiss such modal view, bring up below method and it’ll be solved as good. :D


- (void) temporarilyHideStatusBar {
	[[UIApplication sharedApplication] setStatusBarHidden:YES];
	[self performSelector:@selector(showStatusBar) withObject:nil afterDelay:0];
}
- (void) showStatusBar {
	[[UIApplication sharedApplication] setStatusBarHidden:NO];
}

Above performSelector method is useful when you need a slight moment before the next one to come. It can be used in various situations.

Enjoy! :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

HTML tags are not allowed.