******隐式动画(手指拖拽Layer)

#import "HMViewController.h"

@interface HMViewController ()

@property (nonatomic, weak) CALayer *layer;

@end

@implementation HMViewController

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib. CALayer *layer = [CALayer layer]; // 设置尺寸
layer.bounds = CGRectMake(, , , ); // 颜色
layer.backgroundColor = [UIColor redColor].CGColor; [self.view.layer addSublayer:layer]; _layer = layer; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// 获取触摸点
UITouch *touch = [touches anyObject];
CGPoint pos = [touch locationInView:self.view]; // 开启事务
// [CATransaction begin]; // 取消隐世动画
// [CATransaction setDisableActions:YES];
// _layer.position = CGPointMake(100, 100); // 设置边框
_layer.borderWidth = arc4random_uniform() + ;
CGFloat r = arc4random_uniform() / 255.0;
CGFloat g = arc4random_uniform() / 255.0;
CGFloat b = arc4random_uniform() / 255.0;
// _layer.borderColor = [UIColor colorWithRed:r green:g blue:b alpha:1].CGColor; // 设置背景颜色
_layer.backgroundColor = [UIColor colorWithRed:r green:g blue:b alpha:].CGColor; // 设置圆角半径
_layer.cornerRadius = arc4random_uniform(); // 设置位置
_layer.position = pos; // 提交事务
// [CATransaction commit];
} @end

IOS第18天(3,CALayer隐式动画)的更多相关文章

  1. [iOS Animation]-CALayer 隐式动画

    隐式动画 按照我的意思去做,而不是我说的. -- 埃德娜,辛普森 我们在第一部分讨论了Core Animation除了动画之外可以做到的任何事情.但是动画是Core Animation库一个非常显著的 ...

  2. iOS边练边学--CALayer,非根层隐式动画,钟表练习

    一.CALayer UIView之所以能显示在屏幕上,完全是因为他内部的一个图层 在创建UIView对象时,UIView内部会自动创建一个图层(即CALayer对象),通过UIView的layer属性 ...

  3. iOS:CALayer的隐式动画的详解

    CALayer的隐式动画属性: •每一个UIView内部都默认关联着一个CALayer,称这个Layer为Root Layer.所有的非Root Layer都存在着隐式动画,隐式动画的默认时长为1/4 ...

  4. CALayer的隐式动画

    CALayer的使用 在我的理解中CALayer就是iOS中利用图层精简非交互式绘图.那么那些核心动画类.也就是变化图层的非交互式绘制规则而已.其中的本质就是将CALayer中的内容转化为map图.从 ...

  5. CALayer的隐式动画和显式动画

    隐式事务 任何对于CALayer属性的修改,都是隐式事务,都会有动画效果.这样的事务会在run-loop中被提交. - (void)viewDidLoad { //初始化一个layer,添加到主视图 ...

  6. iOS动画学习 -隐式动画

    事务 Core Animation基于一个假设,说屏幕上的任何东西都可以(或者可能)做动画.你并不需要在Core Animation中手动打开动画,但是你需要明确地关闭它,否则它会一直存在. 当你改变 ...

  7. IOS 隐式动画(非Root Layer)

    ● 每一个UIView内部都默认关联着一个CALayer,我们可用称这个Layer为Root Layer(根 层) ● 所有的非Root Layer,也就是手动创建的CALayer对象,都存在着隐式动 ...

  8. ios开发核心动画三:隐式动画与时钟效果

    一:隐式动画 #import "ViewController.h" @interface ViewController () /** <#注释#> */ @proper ...

  9. iOS中的隐式动画

    隐式动画就是指  在 非 人为在代码中 定义动画  而系统却默认  自带   的动画  叫做隐式动画. 比如  改变 图层  的颜色  位置  和   透明度  的时候    都会  产生附带的渐变的 ...

随机推荐

  1. Codeforces Round #375 (Div. 2) - A

    题目链接:http://codeforces.com/contest/723/problem/A 题意:在一维坐标下有3个人(坐标点).他们想选一个点使得他们3个到这个点的距离之和最小. 思路:水题. ...

  2. Swift3.0语言教程查找字符集和子字符串

    Swift3.0语言教程查找字符集和子字符串 Swift3.0语言教程查找字符集和子字符串,在字符串中当字符内容很多时,我们就需要使用到查找字符集或者子字符串的方法.以下我们将讲解3种查找字符集和子字 ...

  3. java 常见下载合集

    J2SE SDK (JDK): Windows: http://download.oracle.com/auth/otn-pub/java/jdk/6u25-b06/jdk-6u25-windows- ...

  4. Android App 性能优化实践

    本文记录了Android App优化需要用到的工具和以及在实践中的Tips.也算对我这半年来部分工作的总结. 工具 Hierarchy Viewer 是 Android SDK 自带的 Layout ...

  5. Jquery和JS获取ul中li标签

    js 获取元素下面所有的li var content=document.getElementById("content"); var items=content.getElemen ...

  6. OA

    OA(政府) http://zw.wuzhitong.com/oa_wuzhitong/index.asp http://www.wuzhitong.com/Information_ZW.html O ...

  7. Java解析文本

    import java.io.*; import java.util.*; public class FileManager { public List<Dishes> parseFile ...

  8. CF# Educational Codeforces Round 3 C. Load Balancing

    C. Load Balancing time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  9. Excel: Switch (transpose) columns and rows

    链接:https://support.office.com/en-in/article/Switch-transpose-columns-and-rows-ed1215f5-59af-47e6-953 ...

  10. mybatis 查询缓存问题

    <settings> <setting name="localCacheScope" value="STATEMENT" /> < ...