iOS-OC-APP开场动画
来源:互联网 发布:2017网络赚钱新项目 编辑:程序博客网 时间:2024/04/29 08:49
//// 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
1 0
- iOS-OC-APP开场动画
- app首次启动的开场动画
- Android App开场图片动画的实现
- Android APP如何做开场渐变动画
- cocos2d-x项目移植到ios下加入开场动画
- Android 开场渐变动画
- Android开场动画源码
- iOS App启动动画
- qq空间开场动画代码
- Android开场透明度渐变动画
- UE4之添加开场动画
- Android的基础开场动画
- IOS-OC App本地数据库
- iOS MPMoviePlayerController(已废弃)入门使用(模仿keep未登录)&广告动画开场效果
- 开场
- 开场
- 开场
- 新浪博客开场动画效果代码
- NSTimer计时器的使用,创建后一定要销毁,不然会重复使用
- java在win8.1专业版电脑配置
- 290. Word Pattern ——字符串的使用
- Unity多语言本地化极简方案
- Android之数据持久化三(sqllite数据库)二
- iOS-OC-APP开场动画
- 出现( linker command failed with exit code 1)错误总结
- 存取之美——HashMap原理与实践
- 每年WWDC的记录
- 位操作,置位,清零
- iOS获取系统时间
- 手机分辨率导致文字显示不完整的问题
- MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk
- OC------RunTimer