美文网首页
CoreAnimation寄宿图

CoreAnimation寄宿图

作者: 海的原滋味 | 来源:发表于2017-11-10 15:55 被阅读5次
contents:

在MacOS上他是CGImage或者NSImage都可以,但是在IOS必须是一个CGImageRef类型,他其实是一个指向CGImage的指针类型。UIImage有一个CGImage类型,他返回一个CGImageRef类型,如果把这个辅助给图层contents还是显示不出来,因为CGImageRef并不是一个真正的Cocoa类型。

contentsGravity

表示寄宿图的显示模式/位置

contentsScale

显示比例,一个位置放置几个像素

maskToBounds

是否裁剪越界的绘制

contentsRect

和bounds和frame不同的是,采用了单位坐标。默认的contentsRect是{0,0,1,1}
针对这一特性我们可以很方便的对于图片进行裁剪:

CALayer的重绘

(void)displayLayer:(CALayerCALayer *)layer;

如果调用displayLayer,Layer就会尝试调用下面这个方法:

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

相关文章

  • CoreAnimation寄宿图

    contents: 在MacOS上他是CGImage或者NSImage都可以,但是在IOS必须是一个CGImage...

  • iOS CoreAnimation教程 第四篇

    CoreAnimation lineCap 属性效果直接看效果图

  • 寄宿图

    看到这个名字可能会一脸懵逼,什么是寄宿图啊?简单的来说就是图层中包含的图。 contents属性 CALayer有...

  • 寄宿图

    contents属性 定义类型为id,但ios上必须赋值 CGImage,否则图层显示为空 (Mac OS 上 可...

  • Core Animation

    CoreAnimation简介: Core Animation 使用步䠫: Core Animation类的继承图...

  • CALayer----寄宿图

    寄宿图 什么是寄宿图 图层中包含的 View 1. contents 属性 contents: 1> CALaye...

  • IOS开发(四)Animation和存储

    IOS基础控件思维导图 四、动画 1、CoreAnimation (1)CALayer和UIView ​ ...

  • CoreAnimation之隐式动画

    CoreAnimation之CALayer基础CoreAnimation之变换CoreAnimation之常用图层...

  • CALayer寄宿图

    寄宿图 CALayer 类能够包含一张图片,这个图片就是CALayer寄宿图,用属性contents进行赋值。 c...

  • 2、寄宿图

    文章摘录自:https://github.com/AttackOnDobby/iOS-Core-Animation...

网友评论

      本文标题:CoreAnimation寄宿图

      本文链接:https://www.haomeiwen.com/subject/dxgbmxtx.html