Launch animation for iOS development (Dynamic Welcome interface, non-static default)

Source: Internet
Author: User

    • Recently in the use of the "Green Onion Diary" This app, found that its launch interface is very beautiful.

      Different from my own before simply replacing Default.png Pictures. Its dynamic effect is doing well.

      So, it took a little time to realize the function. In fact, it is very simple, the specific effect is as follows

      It is not difficult to achieve. Because we know that when the app starts, it executes the APPDELEGATE.M in the

      -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions

      The view is not entered until the execution is complete. If we add some animations to this method, we'll go into our rootview after the animation is done. This is the principle of implementation. It's simple.

      The following directly to achieve this effect of the source code, very simple. Don't say much nonsense (of course, there are many ways to do it.) I'm just giving my own way)

      Declare a uiimageview in 1.appdelegate.h

      @property (Strong, nonatomic) Uiimageview *splashview;

      2.APPDELEGATE.M Implementing related functions

      @synthesize splashview;-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (    Nsdictionary *) launchoptions{//Override point for customization after application launch.        [Self.window makekeyandvisible];    Splashview = [[Uiimageview alloc]initwithframe:cgrectmake (0, 0, 320, 568)];        [Splashview setimage:[uiimage imagenamed:@ "Back_"];    [Self.window Addsubview:splashview];            [Self.window Bringsubviewtofront:splashview];    [Self performselector: @selector (scale_1) Withobject:nil afterdelay:0.0f];    [Self performselector: @selector (scale_2) Withobject:nil afterdelay:0.5f];    [Self performselector: @selector (scale_3) Withobject:nil afterdelay:1.0f];    [Self performselector: @selector (scale_4) Withobject:nil afterdelay:1.5f];    [Self performselector: @selector (scale_5) Withobject:nil afterdelay:2.0f];        [Self performselector: @selector (Showword) Withobject:nil afterdelay:2.5f]; return YES;} -(void) scale_1{Uiimageview *round_1 = [[Uiimageview Alloc]initwithframe:cgrectmake (100, 240, 15, 15)];    Round_1.image = [UIImage imagenamed:@ "Round_"];    [Splashview Addsubview:round_1]; [Self setanimation:round_1];}    -(void) scale_2{Uiimageview *round_2 = [[Uiimageview alloc]initwithframe:cgrectmake (105, 210, 20, 20)];    Round_2.image = [UIImage imagenamed:@ "Round_"];    [Splashview Addsubview:round_2]; [Self setanimation:round_2];}    -(void) scale_3{Uiimageview *round_3 = [[Uiimageview alloc]initwithframe:cgrectmake (125, 170, 30, 30)];    Round_3.image = [UIImage imagenamed:@ "Round_"];    [Splashview Addsubview:round_3]; [Self setanimation:round_3];}    -(void) scale_4{Uiimageview *round_4 = [[Uiimageview alloc]initwithframe:cgrectmake (160, 135, 40, 40)];    Round_4.image = [UIImage imagenamed:@ "Round_"];    [Splashview Addsubview:round_4]; [Self setanimation:round_4];}    -(void) scale_5{Uiimageview *heart_1 = [[Uiimageview alloc]initwithframe:cgrectmake (130, 180, 100, 100)]; Heart_1.image = [UIImage imagenamed:@ "Heart_"];    [Splashview addsubview:heart_1]; [Self setanimation:heart_1];} -(void) Setanimation: (Uiimageview *) nowview{[UIView animatewithduration:0.6f delay:0.0f Options:uiviewanimationopti                        Oncurvelinear animations:^ {//Executed animation code [Nowview Setframe:cgrectmake (nowview.frame.origin.x-nowview.frame.size.width*0.1, nowview.frame.origin.y-nowview.frame.size.height*0.1, nowview.frame.size.width*1.2, nowView.frame.size.height*                     1.2)];                        } completion:^ (BOOL finished) {//execute code after completion                     [Nowview Removefromsuperview];    }     ]; }-(void) showword{Uiimageview *<a href= "http://www.it165.net/edu/ebg/" target= "_blank" class= "Keylink" &GT;WORD&L    T;/a>_ = [[Uiimageview alloc]initwithframe:cgrectmake (75, 440, 170, 29)]; <a href= "http://www.it165.net/edu/ebg/" Target= "_blank" class= "keylink" >word</a>_.image = [UIImage imagenamed:@ "Word_"];        [Splashview Addsubview:word_];    Word_.alpha = 0.0;                     [UIView animatewithduration:1.0f delay:0.0f options:uiviewanimationoptioncurvelinear animations:^                     {Word_.alpha = 1.0;                         } completion:^ (BOOL finished) {//execute code after completion                         [Nsthread sleepfortimeinterval:1.0f];                     [Splashview Removefromsuperview]; }     ];}

      Study on the road, with June mutual encouragement.

Launch animation for iOS development (Dynamic Welcome interface, non-static default)

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.