@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

CALayer *layer = [CALayer layer];

layer.delegate = self;

layer.bounds = CGRectMake(0, 0, 100, 100);

layer.position = CGPointMake(100, 100);

layer.anchorPoint = CGPointZero;

layer.backgroundColor = [UIColor blackColor].CGColor;

[layer setNeedsDisplay];

[self.view.layer addSublayer:layer];

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx

{

CGContextSetRGBFillColor(ctx, 1.0, 0, 0, 1.0);

CGContextAddRect(ctx, CGRectMake(0, 0, 20, 20));

CGContextFillPath(ctx);

}

CABasicAnimation *basicAnimation = [CABasicAnimation animation];

basicAnimation.keyPath = @"position";

basicAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)];

basicAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(200, 200)];

basicAnimation.duration = 1.0;

basicAnimation.removedOnCompletion = NO;//动画执行完以后不要删除动画

basicAnimation.fillMode = kCAFillModeForwards;//保持最新的状态

[self.layer addAnimation:basicAnimation forKey:nil];

@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

iOS Layer CABasicAnimation的更多相关文章

  1. ios之CABasicAnimation

    博主:最近iOS开发中用到CoreAnimation的framework来做动画效果,虽然以前也用过,但一直没有系统学习过,今天看到一篇非常详细的博文(虽然是日语,但真的写的很好),在此翻译出来供大家 ...

  2. iOS开发CABasicAnimation动画理解

    1.CALayer简介 CALayer是个与UIView很类似的概念,同样有backgroundColor.frame等相似的属性,我们可以将UIView看做一种特殊的CALayer.但实际上UIVi ...

  3. ios layer 动画-(transform.rotation篇)

    x轴旋转: CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"tra ...

  4. IOS Layer的使用

    CALayer(层)是屏幕上的一个矩形区域,在每一个UIView中都包含一个根CALayer,在UIView上的所有视觉效果都是在这个Layer上进行的. CALayer外形特征主要包括: 1.层的大 ...

  5. ios layer 动画

    #import "ViewController.h" @interface ViewController (){    CALayer *_l1;//定义能够全局使用    CAL ...

  6. iOS开发基础知识:Core Animation(核心动画)

    Core Animation,中文翻译为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能. Core A ...

  7. iOS之核心动画(Core Animation)

      Core Animation,中文翻译为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能. Core ...

  8. iOS - Core Animation(核心动画)

    Core Animation,中文翻译为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能.Core An ...

  9. iOS带动画的环形进度条(进度条和数字同步)

    本篇写的是实现环形进度条,并带动画效果,要实现这些,仅能通过自己画一个 方法直接看代码 为了方便多次调用,用继承UIView的方式 .m文件 #import <UIKit/UIKit.h> ...

随机推荐

  1. ADT 连接手机运行android应用程序时报错

    The connection to adb is down, and a severe error has occured.    You must restart adb and Eclipse.  ...

  2. final关键字的作用

    final 可以修饰类.方法.变量. (1):final修饰的变量是一个常量,只能被赋值一次. 常量一般使用final声明,如: public static final String CHINA = ...

  3. rsyslog 收集系统日志

    <pre name="code" class="html">nginx 服务器配置: jrhwpt01:/root# cat /etc/rsyslo ...

  4. EBS查找运行请求时间,参数等

    --查找运行请求时间,参数等(可以是某用户的,某个报表) select c.user_name, papf.full_name, b.user_concurrent_program_name, a.r ...

  5. UESTC_Dividing Numbers CDOJ 1156

    Dividing Numbers Time Limit: 9000/3000MS (Java/Others)     Memory Limit: 262144/262144KB (Java/Other ...

  6. 关于C++中覆盖,重载,隐藏的一点说明

    C++覆盖 重载 隐藏是三个经常容易混淆的概念 这里我们简单总结下: 1.重载的条件(编译时多态) a.同一个类中 b.函数名相同,参数不同(返回值不能作为重载的条件) c.与函数是否为虚函数无关 2 ...

  7. soj 1700 ping_简单dp

    题目链接 题意:给你一个无向图,求n边的最短路 思路:用最短路想了半天都没想出来,比赛结束回去看看原来用dp做,我的dp有待提高啊 sp[i][k]=min(sp[j][k-1]+dp[j][i])/ ...

  8. flex渐变色制作圆角橙色按钮

    <?xml version="1.0" encoding="utf-8"?> <s:SparkButtonSkin xmlns:fx=&quo ...

  9. ListView之BaseAdapter

    BaseAdapter可以实现自定义的丰富子项视图,本文实现如下所示结果: 实现代码: /* ListView :列表 BaseAdapter 通用的基础适配器 * * */ public class ...

  10. hdu 4405 Aeroplane chess(概率+dp)

    Problem Description Hzz loves aeroplane chess very much. The chess map contains N+ grids labeled to ...