I’m having trouble visualizing what’s going on in these few lines of code:
[boxLayer setBounds:CGRectMake(0.0, 0.0, 85.0, 85.0)]; [boxLayer setPosition:CGPointMake(160.0, 100.0)]; // other code [boxLayer setContentsRect:CGRectMake(-0.1, -0.1, 1.2, 1.2)]; [boxLayer setContentsGravity:kCAGravityResizeAspect];
From which point is the origin of the contentsRect -0.1, -0.1 away from? Which is the positive direction for each? What does 0.1 represent?
I would have thought that would be left 10% of the width of the layer, and up 10% of the height of the layer, starting from the top-left corner of the layer, but that doesn’t seem to be the case.
What is the size 1.2, 1.2?
I would have thought that this would be a Rect 120% the width and height of the layer, so that these two lines of code essentially cause you to zoom in on the image.
Here’s what I thought was going on: