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);

 

你可能感兴趣的:(iOS学习笔记32 - 锚点)