ios - 如何在 iOS 7 和 iOS 6 中的动画启动屏幕期间隐藏状态栏?

标签 ios iphone

我正在“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];
}

最佳答案

您进入“项目设置”->“常规”。有一个选项状态栏样式

enter image description here

编辑 使用 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/

相关文章:

iphone - 使用 OpenGL 在 iPad 上绘图应用程序

ios - 自定义进度条自动布局的动画宽度约束

iphone - 应用内购买失败的交易

ios - ImageView 旋转在 collectionView 单元格内无法正常工作

ios - 无法更新 XCode : Not enough space

iphone - 检测透明 UIImageview 之间的碰撞

javascript - iPhone 的网页 - 大字体而不是滚动?

iphone - NSFileManager removeItemAtPath 锁定主线程

ios - CGContextStrokeRect 未出现在 View 中

ios - 如何居中 subview