iOS学习笔记32 - 锚点

 CALayer *layer = [CALayer layer];

    [layer setBackgroundColor:[UIColor redColor].CGColor];

    

    layer.bounds = CGRectMake(0, 0, 100, 100);

    layer.anchorPoint = CGPointMake(1, 0);

    

    layer.position = CGPointMake(200, 200);

 

    [self.view.layer addSublayer:layer];

 

 

旋转的时候可以用到锚点

 

 layer.transform = CATransform3DRotate(layer.transform, M_PI_4, 1, 1, 0);

 

posted @ 2016-03-03 16:57  small-elephant_A-Do  阅读(140)  评论(0编辑  收藏  举报