码迷,mamicode.com
首页 > 其他好文 > 详细

程序启动动画

时间:2015-05-24 14:18:37      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:uiwindow   uiviewanimation   

#import <UIKit/UIKit.h>


@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIImageView *splashView;

@property (strong, nonatomic) UIWindow *window;



@end


#import "AppDelegate.h"


@interface AppDelegate ()


@end


@implementation AppDelegate


-(void)scale_1

{

    UIImageView *round_1 = [[UIImageView alloc]initWithFrame:CGRectMake(100, 240, 15, 15)];

    round_1.image = [UIImage imageNamed:@"image_05"];

    [_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:@"image_05"];

    [_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:@"image_04"];

    [_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:@"Image_03"];

    [_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:@"image_02"];

    [_splashView addSubview:heart_1];

    [self setAnimation:heart_1];

}


-(void)setAnimation:(UIImageView *)nowView

{

    

    [UIView animateWithDuration:0.6f delay:0.0f options:UIViewAnimationOptionCurveLinear

                     animations:^

     {

         // 执行的动画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)

     {

         // 完成后执行code

         [nowView removeFromSuperview];

     }

     ];

    

    

}


-(void)showWord

{

    

    UIImageView *imageView= [[UIImageView alloc]initWithFrame:CGRectMake(75, 440, 170, 29)];

    imageView.image = [UIImage imageNamed:@"image_01"];

    [_splashView addSubview:imageView];

    

    imageView.alpha = 0.0;

    [UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionCurveLinear

                     animations:^

     {

         imageView.alpha = 1.0;

     }

                     completion:^(BOOL finished)

     {

         // 完成后执行code

         [NSThread sleepForTimeInterval:1.0f];

         [_splashView removeFromSuperview];

     }

     ];

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [self.window makeKeyAndVisible];

    

    _splashView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 568)];

    [_splashView setImage:[UIImage imageNamed:@"00"]];

    

    [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;

}



程序启动动画

标签:uiwindow   uiviewanimation   

原文地址:http://blog.csdn.net/chungeshihuatian/article/details/45951185

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!