iOS development-Customize the background display picture (Ios7-background fetch app)

Source: Internet
Author: User

Before using the battery doctor, found that it has a function: when the application into the background, will show another image overlay app switcher display interface.

The effect is as follows:

Become a---->


And such a feature, for the protection of user privacy is very useful.

This involves the use of background fetch. Of course, Background Fetch has more, more useful features,

Seethe IOS 7 learning: Background Fetch for multitasking


The following is an introduction to the background picture switch implementation.


1. program configuration background mode

The operation is as follows:


2. AppDelegate.h Add code:

@property (Strong, nonatomic) Uiimageview *splashview;

3.APPDELEGATE.M Add code:

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 didfinishlaunchingwithoptions: (nsdictionary *) launchoptions{//Override point for Customi        Zation 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 (@ "Backstage acquisition"); Completionhandler (uibackgroundfetchresultnewdata);} -(void) Applicationwillresignactive: (uiapplication *) application{//Sent when the application was about to move from aCtive to inactive state. This can occur for certain types of temporary interruptions (such as a incoming phone call or SMS message) or when the US    Er quits the application and it begins the transition to the background state. Use the This method to the pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should with this method to pause the game.}    -(void) Applicationdidenterbackground: (uiapplication *) application{[Self.window Addsubview:splashview];    [Self.window Bringsubviewtofront:splashview]; Use the This method to release the shared resources, save user data, invalidate timers, and store enough application state info     Rmation to the restore your application to the 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's can undo many of the changes made on entering the background.} -(void) Applicationdidbecomeactive: (uiapplication *) application{//Restart Any tasks this were paused (or not yet star Ted) While the application was inactive. If the application is previously in the background, optionally refresh the user interface.} -(void) Applicationwillterminate: (uiapplication *) application{//Called when the application was about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.} @end



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.