@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. IE10-IE11在NET4.0下出现“__doPostBack未定义”解决方案

    IE10在NET4.0下出现"__doPostBack未定义"的办法 参考文章: http://blogs.msdn.com/b/scott_hanselman/archive/2 ...

  2. eclipse php 开发环境配置

    一般常用的是eclipse+pdt.我是直接下载的Eclipse for php :http://www.eclipse.org/downloads/packages/eclipse-php-deve ...

  3. mysql 增量导入到elasticsearch

    <pre name="code" class="html">zjtest7-redis:/odbc_es# cat /odbc_es/run_mys ...

  4. Spring使用小结2

    之前做过不少spring想过知识点内容的摘录, Spring框架的特点.模块组成.优缺点 spring相关的bean管理想过知识点及依赖注入方式 今天说下近端时间中项目中遇到的相关印象比较深的知识点 ...

  5. Grunt 插件开发与调式

    1 grunt是什么 官方网站解释的很清楚,http://gruntjs.com/ http://gruntjs.cn/ 它是一种javascript任务运行器,对于需要反复重复的任务,例如压缩.编译 ...

  6. 【POJ3299】Humidex(简单的数学推导)

    公式题中已经给出,直接求解即可. #include <iostream> #include <cstdlib> #include <cstdio> #include ...

  7. pyqt动态创建一系列组件并绑定信号和槽(网友提供学习)

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #如上图要求:创建指定多个复选框,一种是通过QT设计器Designe ...

  8. 从手工测试逆袭为NB自动化测试的学习路线

    在开始之前先学习两个工具商业web自动化测试工具请学习QTP:QTP的学习可以跳过,我是跳过了的.开源web自动化测试工具请学习Selenium:我当年是先学watir,再学selenium 这里主要 ...

  9. redmine fastcgi常常崩溃的解决方式

    最终找到了解决方法,在以下的文件里加入两行就可以: /home/redmine/redmine-2.5.1/public/dispatch.fcgi require 'rubygems' requir ...

  10. [Hapi.js] View engines

    View engines, or template engines, allow you to maintain a clean separation between your presentatio ...