how to hide status bar when splash screen appears

2019-01-20 23:54发布

Is there a way to hide the status bar when showing splash screen in iPhone and then show again in application?

11条回答
甜甜的少女心
2楼-- · 2019-01-21 00:14

On iOS 10 (beta 8) if Status bar is initially hidden key is set to YES, splash view is displayed without status bar, and it becomes visible automatically after splash view disappears, no need to code.

Note I'm using Apple's recommended way of showing a splash: storyboard, and not sure this will work with launch images.

查看更多
smile是对你的礼貌
3楼-- · 2019-01-21 00:18

View -> Property List Type -> iPhone Info.plist. Now, make a new item with "Status bar is initially hidden" checked.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-21 00:21

The correct key in .plist is "UIStatusBarHidden" and make checked right side.It'l become "Status bar is initially hidden" then automatically. In my practice, you can control the StatusBar's show/hide anywhere by when hide:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 0, 320, 480); //full screen.

when show:

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
[UIApplication sharedApplication].keyWindow.frame=CGRectMake(0, 20, 320, 460); //move down 20px.

hope this was helpful to you.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-01-21 00:21

Add Status bar is initially hidden to YES in the info.plist file. This worked for me.

status bar hidden

查看更多
ら.Afraid
6楼-- · 2019-01-21 00:22

is deprecated

setStatusBarHidden:(BOOL) animated:(BOOL) 

is the correct

setStatusBarHidden:(BOOL) withAnimation:(UIStatusBarAnimation)

UIStatusBarAnimation which can be:

UIStatusBarAnimationNone or UIStatusBarAnimationFade or UIStatusBarAnimationSlide

查看更多
欢心
7楼-- · 2019-01-21 00:23

Following up Dave's answer the key "Status bar is initially hidden" didn't work for me under iOS 4.3 BUT the key "UIStatusBarHidden" and then setting it's type to Boolean and checking the box did the trick.

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW4

This developer article got me onto the Info.plist keys and then working out the equivalent key for hiding it wasn't too hard.

Interestingly the "UIStatusBarStyle" needs to use the enumeration name as a string for it to work.

查看更多
登录 后发表回答