The program startup diagram disappears after a delay

The program startup diagram disappears after a delay

Add an animation when the program starts! (If your code is written directly in appdelegate, paste it directly and it will be OK, if you make a startup diagram separately, then paste this code in the past, just need to It's OK to replace window with view!!)

CGSize viewSize = self.window.bounds.size;
NSString *viewOrientation = @"Portrait";   // @"Landscape"
NSString *launchImage = nil;

NSArray* imagesDict = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"UILaunchImages"];
for (NSDictionary* dict in imagesDict)
{
    CGSize imageSize = CGSizeFromString(dict[@"UILaunchImageSize"]);
    
    if (CGSizeEqualToSize(imageSize, viewSize) && [viewOrientation isEqualToString:dict[@"UILaunchImageOrientation"]])
    {
        launchImage = dict[@"UILaunchImageName"];
    }
}

UIImageView *launchView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:launchImage]];
launchView.frame = self.window.bounds;
launchView.contentMode = UIViewContentModeScaleAspectFill;
[self.window addSubview:launchView];

[UIView animateWithDuration:2.0f
                      delay:0.0f
                    options:UIViewAnimationOptionBeginFromCurrentState
                 animations:^{
                     
                     launchView.alpha = 0.8f;
                     launchView.layer.transform = CATransform3DScale(CATransform3DIdentity, 1.2, 1.2, 1);
                     
                 }
                 completion:^(BOOL finished) {
                     
                     [launchView removeFromSuperview];
                
                 }];