初始屏幕上的Iphone简历

我想在应用程序从后台恢复时在我的应用程序中添加启animation面。这可能吗? 提前致谢

您可以在-[UIApplicationDelegate applicationWillResignActive:]更新您的视图堆栈。

当应用程序恢复时,更改将可见,并且您可以在-[UIApplicationDelegate applicationDidBecomeActive:]再次删除启animation面。

一些代码与Morten的答案一起。 我也想注意到,这在模拟器中不能正常工作,但是在设备上运行时会出现这种情况。 模拟器显示一个黑屏直到removeFromSuperview被调用。

 - (void)applicationDidEnterBackground:(UIApplication *)application { // We don't want to show a splash screen if the application is in UIApplicationStateInactive (lock/power button press) if (application.applicationState == UIApplicationStateBackground) { UIImageView *splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"splashimage.png"]]; splash.frame = self.window.bounds; [self.window addSubview:splash]; } } - (void)applicationDidBecomeActive:(UIApplication *)application { // Make sure you do not remove the last view in the event something odd happens if ([[self.window subviews] count] > 1) { // Not recommended by Apple, but client gets what client wants [NSThread sleepForTimeInterval:1.0]; [[[self.window subviews] lastObject] removeFromSuperview]; } } 

请注意,我使用applicationDidEnterBackground而不是applicationWillResignActive,因为applicationState有助于区分“按下homebutton”和“按下locking/电源button”。 UIApplicationStateBackground =“按下主页button”。