码迷,mamicode.com
首页 > 移动开发 > 详细

CALayerDelegate的实现(IOS)

时间:2015-01-03 23:59:55      阅读:446      评论:0      收藏:0      [点我收藏+]

标签:ios

CALayerDelegate的实现(IOS)

by 伍雪颖

技术分享
- (void)viewDidLoad {
    [
super viewDidLoad];
   
CALayer *blueLayer = [CALayer layer];
    blueLayer.
frame = CGRectMake(50, 50, 100, 100);
    blueLayer.
backgroundColor = [UIColor blueColor].CGColor;
    [
self.layerView.layer addSublayer:blueLayer];
   
    blueLayer.
delegate = self;
    blueLayer.
contentsScale = [UIScreen mainScreen].scale;
   
    [blueLayer
display];
}

- (
void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
   
CGContextSetLineWidth(ctx, 10);
   
CGContextSetStrokeColorWithColor(ctx, [UIColor redColor].CGColor);
   
CGContextStrokeEllipseInRect(ctx, layer.bounds);
}

CALayerDelegate的实现(IOS)

标签:ios

原文地址:http://blog.csdn.net/rainlesvio/article/details/42374141

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!