我在“didFinishLaunchingWithOptions”方法中创建动画闪屏 . 动画启动画面持续时间为2秒 . 两秒钟后,我隐藏了动画启动画面 . 当动画屏幕出现时我想隐藏状态栏,当动画屏幕消失时,我想显示状态栏 .
怎么做?
- (BOOL)应用程序:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//我在这里创建动画启动画面
**** ********* 这里我要隐藏状态栏* **********
splashView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 580)];
splashView.backgroundColor =[UIColor whiteColor];
[self.window addSubview:splashView];
logoView = [[UIImageView alloc] initWithFrame:CGRectMake(logoX,0, 225, 25)];
logoView.image = [UIImage imageNamed:@"logoImage"];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
splashView.alpha = 1.0;
logoView.frame = CGRectMake(logoX, logoY, 225, 25);
[window addSubview:logoView];
[window bringSubviewToFront:logoView];
[UIView commitAnimations];
//隐藏动画启动画面2秒钟后
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
************* Here i want to show Status bar Again ***************
[splashView removeFromSuperview];
[logoView removeFromSuperview];
}
3 回答
在plist文件中添加以下条目:
"Status bar is initially hidden" =是:隐藏应用程序启动时和启动屏幕中的状态栏
"View controller-based status bar appearance" =否:防止视图控制器类显示状态栏
您可以为UIViewController创建一个类别
你进入ProjectSettings - > General . 有一个选项
Status Bar Style
.EDIT 使用块 . 它们为动画提供了非常简单的语法 .