我正在“didFinishLaunchingWithOptions”方法中创建动画启动屏幕。动画启动画面持续时间为 2 秒。两秒钟后,我隐藏了动画启动屏幕。当动画屏幕出现时,我想隐藏状态栏,当动画屏幕消失时,我想显示状态栏。
如何做到这一点?- (BOOL)application:(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];
}
最佳答案
您进入“项目设置”->“常规”。有一个选项状态栏样式
。
编辑 使用 block 。它们为动画提供了非常简单的语法。
[UIView animateWithDuration:2.0 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
//your animation code here
//all changes made here to frame, bounds, alpha etc. are animated
} completion:^(BOOL finished) {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
//this is called after animation finishes
}];
关于ios - 如何在 iOS 7 和 iOS 6 中的动画启动屏幕期间隐藏状态栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22268689/