如何在我们的应用程序中添加动画闪屏

Arc*_*sia 8 iphone objective-c

如何在我们的应用程序中添加动画闪屏.

小智 4

您可以使用图像序列,这里是代码:

for(NSInteger i=1;i<=totalImages;i++){
        NSString *strImage = [NSString stringWithFormat:@"Activity_%d",i];
        UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:strImage ofType:@"png"]];
        [imageArray addObject:image];
    }
    splashImageView.animationImages = imageArray;
    splashImageView.animationDuration = 0.8;
Run Code Online (Sandbox Code Playgroud)

只需调用 UIImageView 的 startAnimation 和 endAnimation 方法即可。