I am drawing ellipse using following UIBezierPath
method:
UIBezierPath *bpath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(x, y, width, height)];
This gives me something like below:
But I want to draw ellipse at an angle like below:
I know one solution is to rotate the UIView
. But I cannot do this because same view contain other bezier paths. So I want to know if there is any way to draw this ellipse at an angle?
Often the easiest way is to put this on a CAShapeLayer
and then rotate the layer. The math for that tends to be very simple (particularly if you want to change the transform later). But you can also just rotate the path directly before drawing it by creating a rotation transform (CGAffineTransformMakeRotation
) and using -applyTransform:
to modify the path.