iOSAPP开场动画

热门标签

,

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!

//
//  AppDelegate.m
//  开场动画demo
//
//  Created by ZFJ_APPLE on 16/1/25.
//  Copyright © 2016年张福杰. All rights reserved.
//
 
#import "AppDelegate.h"
 
@interface AppDelegate ()
 
@property (strong,nonatomic) UIImageView *splashView;//开场动画的背景图片
 
@end
 
@implementation AppDelegate
 
 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    //这是开场动画函数
    [selfsetStartAnimation];
    
    return YES;
}
 
#pragma mark - 设置启动动画
- (void)setStartAnimation
{
    [self.windowmakeKeyAndVisible];
    
    _splashView = [[UIImageViewalloc]initWithFrame:self.window.bounds];
    [_splashViewsetImage:[UIImageimageNamed:@"4.png"]];
    
    [self.windowaddSubview:_splashView];
    [self.windowbringSubviewToFront:_splashView];
    
    //设置动画
    [selfperformSelector:@selector(scale_1)withObject:nilafterDelay:0.0f];
    [selfperformSelector:@selector(scale_2)withObject:nilafterDelay:0.5f];
    [selfperformSelector:@selector(scale_3)withObject:nilafterDelay:1.0f];
    [selfperformSelector:@selector(scale_4)withObject:nilafterDelay:1.5f];
    [selfperformSelector:@selector(scale_5)withObject:nilafterDelay:2.0f];
    [selfperformSelector:@selector(showWord)withObject:nilafterDelay:2.5f];
}
 
- (void)scale_1
{
    NSLog(@"1-%@",[NSThreadcurrentThread]);
    UIImageView *round_1 = [[UIImageViewalloc]initWithFrame:CGRectMake(100,240, 15, 15)];
    round_1.image = [UIImageimageNamed:@"3.jpg"];
    [_splashView addSubview:round_1];
    [self setAnimation:round_1];
}
 
- (void)scale_2
{
    NSLog(@"2-%@",[NSThreadcurrentThread]);
    UIImageView *round_2 = [[UIImageViewalloc]initWithFrame:CGRectMake(105,210, 20, 20)];
    round_2.image = [UIImageimageNamed:@"3.jpg"];
    [_splashView addSubview:round_2];
    [self setAnimation:round_2];
}
 
- (void)scale_3
{
    NSLog(@"3-%@",[NSThreadcurrentThread]);
    UIImageView *round_3 = [[UIImageViewalloc]initWithFrame:CGRectMake(125,170, 30, 30)];
    round_3.image = [UIImageimageNamed:@"3.jpg"];
    [_splashView addSubview:round_3];
    [self setAnimation:round_3];
}
 
- (void)scale_4
{
    NSLog(@"4-%@",[NSThreadcurrentThread]);
    UIImageView *round_4 = [[UIImageViewalloc]initWithFrame:CGRectMake(160,135, 40, 40)];
    round_4.image = [UIImageimageNamed:@"3.jpg"];
    [_splashView addSubview:round_4];
    [self setAnimation:round_4];
}
 
- (void)scale_5
{
    UIImageView *heart_1 = [[UIImageViewalloc]initWithFrame:CGRectMake(130,180, 100, 100)];
    heart_1.image = [UIImageimageNamed:@"3.jpg"];
    [_splashView addSubview:heart_1];
    [self setAnimation:heart_1];
}
 
- (void)showWord
{
    
    UIImageView *word_ = [[UIImageViewalloc]initWithFrame:CGRectMake(75,440, 170, 170)];
    word_.image = [UIImageimageNamed:@"3.jpg"];
    [_splashView addSubview:word_];
    
    word_.alpha = 0.0;
    [UIViewanimateWithDuration:1.0fdelay:0.0foptions:UIViewAnimationOptionCurveLinear
                     animations:^
     {
         word_.alpha = 1.0;
     }
                     completion:^(BOOL finished)
     {
         // 完成后执行code
         [NSThreadsleepForTimeInterval:1.0f];
         [_splashViewremoveFromSuperview];
     }
     ];
}
 
- (void)setAnimation:(UIImageView *)nowView
{
    
    [UIViewanimateWithDuration:0.6fdelay:0.0foptions: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)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 should use this method to pause the game.
}
 
- (void)applicationDidEnterBackground:(UIApplication *)application {
    // 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 {
    // Called as part of the transition from the background to the inactive state; here you can undo many 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 previously 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

 

未经允许不得转载:作者:SheaYang, 转载或复制请以 超链接形式 并注明出处 技术Dog|博客
原文地址:《iOSAPP开场动画》 发布于2019-10-31

分享到:
赞(0) 打赏

评论 抢沙发

6 + 4 =


iOSAPP开场动画

长按图片转发给朋友

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

Vieu4.0主题
专业打造轻量级个人企业风格博客主题!专注于前端开发,全站响应式布局自适应模板。

登录

忘记密码 ?