When i use CATextLayer in swift 5, i align it to center by using Horizontal alignment modes follow here but it cannot align to center. Here is some of my code
myLabel.textAlignment = .center
textLayer.frame = myLabel.bounds;
textLayer.alignmentMode = CATextLayerAlignmentMode.center
But when i run on ipad pro, i set position x to 500 and it moved to center
textLayer.position = CGPoint(500,20)
But it's not exact and i don't know the reason why it is. So how can i align the CATextLayer exactly to the center as the center Label text?