I have a CALayer, containing few sublayers (CATextLayers). I'm applying transformations on the CALayer on some usual gestures (zoom, pan). Everything works perfectly fine except that the scaling (zoom) is done towards the bottom left corner instead of the center of the screen.
I found some info in the CoreAnimation programming guide and I tried setting the anchor point to the center of my screen so that every transformation would be done towards that anchor....But it doesn't seem to be working as expected.
Here's my code :
// inside the init function :
_layerMgr = [[CALayer alloc] init];
_layerMgr.frame = [[UIScreen mainScreen] bounds];
_layerMgr.anchorPoint = CGPointMake(0.5, 0.5);
// done on gesture events :
CGAffineTransform tt = CGAffineTransformMakeTranslation( offset.x, -offset.y);
CGAffineTransform st = CGAffineTransformMakeScale( scale ,scale );
CGAffineTransform rt = CGAffineTransformMakeRotation(rotation);
transform = CGAffineTransformConcat( tt, CGAffineTransformConcat( st,rt) );
_layerMgr.transform = CATransform3DMakeAffineTransform(_transform);
Maybe the problem comes from my subviews ? I've added them using the addSubView method...nothing fancy...