iOS

通过 Image 和 UIWindow 模拟系统 Launchi

2024-02-29  本文已影响0人  survivorsfyh

模拟系统 Launchimage 启动页效果,通过 Image 和 UIWindow 组合并添加动画的方式,具体实现如下所示;

/// 模拟 launchimage 启动页
- (void)setupStartupPage {
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:self.window.bounds];
    [imgView setImage:[[UIImage imageNamed:@"splash_bg_iOS"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [self.window addSubview:imgView];
    [self.window bringSubviewToFront:imgView];
    imgView.alpha = 0.99;
    [UIView animateWithDuration:3.f delay:0.f options:UIViewAnimationOptionTransitionNone animations:^{
        imgView.alpha = 1;
    } completion:^(BOOL finished) {
        [imgView removeFromSuperview];
    }];
}

以上便是此次分享的全部内容,希望能对大家有所帮助!

上一篇 下一篇

猜你喜欢

热点阅读