CALayer绘制图层
来源:互联网 发布:唐筛检查结果数据分析 编辑:程序博客网 时间:2024/05/18 00:44
#import <QuartzCore/QuartzCore.h>
//实例化子图层
CALayer *myLayer = [CALayerlayer];
[myLayer setBounds:CGRectMake(0,0, 200,200)];
[myLayer setBackgroundColor:[UIColorredColor].CGColor];
[myLayer setPosition:CGPointMake(100,100)];
[self.view.layeraddSublayer:myLayer];
// 提示:不能将视图设置为layer的代理
// [myLayer setDelegate:self.view];
[myLayer setDelegate:self];
// 提示,如果要重绘CALayer,必须要调用setNeedDisplay方法
[myLayer setNeedsDisplay];
NSLog(@"%@", myLayer);
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
CGRect rect =CGRectMake(50,50, 100,100);
CGContextSetRGBFillColor(ctx,0.0, 0.0, 1.0,1.0);
CGContextSetRGBStrokeColor(ctx,0.0, 1.0, 0.0,1.0);
CGContextAddRect(ctx, rect);
CGContextDrawPath(ctx,kCGPathFillStroke);
- CALayer绘制图层
- CALayer绘制折线图
- CALayer 自定义图层
- CALayer图层
- CALayer图层
- 图层(CALayer)
- CALayer图层
- IOS 图层CALayer
- CALayer图层
- CALayer图层
- CALayer图层2
- CALayer创建图层
- CAlayer自定义图层
- CALayer 图层简介
- 图层CALayer
- iOS开发 - CALayer图层
- iOS CALayer视图图层
- CALayer-CAEmitterLayer(粒子图层)
- gluPerspective的一些理解
- selenium之 一个不常用但又很有用的方法(switch_to.active_element),获取当前焦点元素
- js获取<input>的value
- Java,方法的重写和重载
- MP4文件格式解析
- CALayer绘制图层
- 新手入门,和风天气预报免费API接口用GSON工具实现数据解析
- NYOJ 488 素数环
- 使用Servlet3.0和XMLHttpRequest Level 2处理文件上传
- java 内部类
- php面向对象之接口教程
- myBatis Mapper接口注入null指针
- [leetcode]1. Two Sum
- 正则表达式