gpt4 book ai didi

ios - 每次应用程序激活时显示启动画面

转载 作者:技术小花猫 更新时间:2023-10-29 10:06:53 27 4
gpt4 key购买 nike

我希望每次应用程序激活时都显示启动画面。我创建了一个函数 showSplash,我在 applicationDidBecomeActive:

中调用它
-(void)showSplash
{
UIImageView *splashScreen = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"Default.png"]];
[self.window.rootViewController.view addSubview: splashScreen];
[self.window makeKeyAndVisible];
NSLog(@"begin splash");
[UIView animateWithDuration: 4.2
delay: 0.5
options: UIViewAnimationOptionCurveEaseOut
animations: ^{
splashScreen.alpha = 0.0;
}
completion: ^ (BOOL finished) {
[splashScreen removeFromSuperview];
NSLog(@"end splash");
}
];
}

这就是我调用这个函数的方式:

- (void)applicationDidBecomeActive:(UIApplication *)application {
[self showSplash];
}

但是没有出现启动画面。请指正。

最佳答案

如果您希望应用程序在您每次返回时都有一个全新的开始,您还可以禁用后台执行,如 Apple Documentation 中所述(最后一节标题为“选择退出后台执行”):

If you do not want your app to run in the background at all, you can explicitly opt out of background by adding the UIApplicationExitsOnSuspend key (with the value YES) to your app’s Info.plist file.

关于ios - 每次应用程序激活时显示启动画面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30059353/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com