I have a CAShapeLayer drawn from a UIBezierPath but for some reason the translation and scale applied on the bezier did not carry over to the CAShapeLayer when it was drawn. Is there any way of applying the same transformations to it? Here is the code for my Bezier:
//// General Declarations
CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *color = [UIColor colorWithRed: 1 green: 1 blue: 1 alpha: 1];
///Where the Transformations are
CGContextTranslateCTM(context, 52.7, 45.46);
CGContextScaleCTM(context, 0.5, 0.5);
UIBezierPath *trackPath = UIBezierPath.bezierPath;
[trackPath moveToPoint: CGPointMake(-28.3, 160.72)];
[trackPath addCurveToPoint: CGPointMake(125.37, -41.18) controlPoint1: CGPointMake(-28.3, 160.72) controlPoint2: CGPointMake(-11.62, -41.18)];
[trackPath addCurveToPoint: CGPointMake(279.04, 160.72) controlPoint1: CGPointMake(262.36, -41.18) controlPoint2: CGPointMake(279.04, 160.72)];
[trackPath moveToPoint: CGPointMake(279.04, 160.82)];
[trackPath addCurveToPoint: CGPointMake(432.7, 362.72) controlPoint1: CGPointMake(279.04, 160.82) controlPoint2: CGPointMake(295.72, 362.72)];
[trackPath moveToPoint: CGPointMake(-28.76, 160.82)];
[trackPath addCurveToPoint: CGPointMake(-182.43, 362.72) controlPoint1: CGPointMake(-28.76, 160.82) controlPoint2: CGPointMake(-45.45, 362.72)];
CGContextSaveGState(context);
[color setStroke];
trackPath.lineWidth = 1;
[trackPath stroke];
CGContextDrawPath(context, kCGPathFill);
CGContextRestoreGState(context);
And this is my CAShapeLayer
raceTrack = [CAShapeLayer layer];
raceTrack.path = trackPath.CGPath;
raceTrack.strokeColor = [UIColor whiteColor].CGColor;
raceTrack.fillColor = [UIColor clearColor].CGColor;
raceTrack.lineWidth = 1;
[self.layer addSublayer:raceTrack];