UIView 基础动画
来源:互联网 发布:营养师网络兼职招聘 编辑:程序博客网 时间:2024/06/01 08:26
//// CHAppDelegate.m// uiAn动画//// Created by imac on 14-10-14.// Copyright (c) 2014年 ___FULLUSERNAME___. All rights reserved.//#import "CHAppDelegate.h"@implementation CHAppDelegate{ UIImageView * _imageView;}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 30, 30)]; imageView.center = CGPointMake(320-15,100); NSMutableArray * images = [[NSMutableArray alloc]init]; for (int i = 1; i < 9; i++) { NSString * path =[[NSBundle mainBundle]pathForResource:[NSString stringWithFormat:@"%.2d",i] ofType:@"JPG"]; UIImage * image = [UIImage imageWithContentsOfFile:path]; [images addObject:image]; } imageView.animationImages = images; // // imageView.animationDuration = 0.5;// // imageView.animationRepeatCount = 0;// _imageView = imageView; [images release]; [self useAnimate]; NSTimer * myTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(useAnimate) userInfo:nil repeats:YES]; [self.window addSubview:imageView]; [imageView release]; [self.window makeKeyAndVisible]; return YES;}-(void)useAnimate{ //_imageView.animationRepeatCount = 4; [UIView animateWithDuration:2 animations:^{ CGPoint point = _imageView.center; point.x -= 320-30; _imageView.center = point;// if (_imageView.center.x > 0) {// _imageView.transform =(CGAffineTransformTranslate(_imageView.transform, -300, 0));// } }completion:^(BOOL finished) { _imageView.transform = CGAffineTransformScale(_imageView.transform, -1, 1); [UIView animateWithDuration:2 animations:^{ CGPoint point = _imageView.center; point.x += 320-30; _imageView.center = point; }completion:^(BOOL finished) { _imageView.transform = CGAffineTransformScale(_imageView.transform, -1, 1); }]; }]; [_imageView startAnimating]; }- (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
0 0
- UIView 基础动画
- UIView 基础动画
- IOS动画类型 UIVIEW基础动画
- iOS 动画-UIView 基础动画
- IOS学习 动画和绘画:UIView基础动画
- UIView动画
- UIView 动画
- UIView动画
- uiview动画
- UIView动画
- UIView 动画
- UIView动画
- 动画 UIView
- UIView动画
- UIView动画
- uiview 动画
- UIView 动画
- UIView动画
- OpenGLShader 编程系列 - 查询shader中的Uniforms
- LeetCode OJ 之 Evaluate Reverse Polish Notation (求逆波兰表达式的值)
- Linux中2>&1使用
- R的slidify 第一个ppt
- 关于C语言的一些容易搞混的问题
- UIView 基础动画
- C单链表的操作(创建、插入、删除)
- Android: 设置模拟按键快捷方式
- Oracle 12c 配置和修改 CDB 和 PDB 参数
- Android 5.0材料设计 RecyclerView的使用
- windows mysql 自动备份的几种方法
- Linux查看CPU和内存使用情况
- 使用静态库--调试错误
- jQuery事件