When I was using a battery doctor, I found that the App has the following function: When the App enters the background, another image will be displayed to overwrite the interface shown by App Switcher.
The effect is as follows:
Change to ---->
Such a function is useful for protecting user privacy.
This involves the use of Background Fetch. Of course, Background Fetch has more and more useful functions,
For details, see --> iOS 7 learning: Background Fetch for multitasking
Next we will introduce the implementation of background image switching.
1. Background mode of program Configuration
The procedure is as follows:
2. Add code for AppDelegate. h:
@property (strong, nonatomic) UIImageView *splashView;
3. Add code for AppDelegate. m:
//// AppDelegate. m // FuckTest /// Created by Colin on 14-4-5. // Copyright (c) 2014 icephone. all rights reserved. // # import "AppDelegate. h "@ implementation AppDelegate @ synthesize splashView;-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {// Override point for customization after application launch. [application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum]; [self. window makeKeyAndVisible]; splashView = [[UIImageView alloc] initWithFrame: CGRectMake (0, 0,320,568)]; [splashView setImage: [UIImage imageNamed: @ "Default-568h.png"]; return YES ;} -(void) application :( UIApplication *) application performFetchWithCompletionHandler :( void (^) (UIBackgroundFetchResult) completionHandler {NSLog (@ "get in the background"); completionHandler (handler );} -(void) applicationWillResignActive :( UIApplication *) application {// Sent when the application is about to move from active to inactive state. this can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. games shocould use this method to pause the game .} -(void) applicationDidEnterBackground :( UIApplication *) application {[self. window addSubview: splashView]; [self. window bringSubviewToFront: splashView]; // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits .} -(void) applicationWillEnterForeground :( UIApplication *) application {[self. splashView removeFromSuperview]; // Called as part of the transition from the background to the inactive state; here you can undo changes of the changes made on entering the background .} -(void) applicationDidBecomeActive :( UIApplication *) application {// Restart any tasks that were paused (or not yet started) while the application was inactive. if the application was previusly in the background, optionally refresh the user interface .} -(void) applicationWillTerminate :( UIApplication *) application {// Called when the application is about to terminate. save data if appropriate. see also applicationDidEnterBackground :.} @ end