美文网首页
iOS启动屏后再加个闪屏的方法

iOS启动屏后再加个闪屏的方法

作者: Style_伟 | 来源:发表于2016-08-24 14:00 被阅读209次
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  
        self.window.rootViewController.view.alpha = 0;  
      _splashImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Default"]];  
        _splashImageView.frame = [UIScreen mainScreen].bounds;  
        [self.window addSubview:_splashImageView];  
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{  
                [UIView animateWithDuration:0.5 animations:^{  
                    self.window.rootViewController.view.alpha = 1.0;  
                } completion:^(BOOL finished) {  
                    [_splashImageView removeFromSuperview];  
                }];  
        });  
        return YES;  
    }  
    

    自定义图片加载,延时时间,以及动画收回时间。

    转载http://www.starming.com/index.php?v=index&view=21

    相关文章

      网友评论

          本文标题:iOS启动屏后再加个闪屏的方法

          本文链接:https://www.haomeiwen.com/subject/kofosttx.html