chrs
chrs

Reputation: 6096

Counter Clockwise stroke on CAShapeLayer

How do you set the direction for the strokeStart and strokeEnd on a CAShapeLayer

This is what you get out of the box. (strokeEnd is 0.75)

How can you make it move the opposite way (strokeEnd is 0.75)

Upvotes: 1

Views: 885

Answers (1)

DeFrenZ
DeFrenZ

Reputation: 2252

The problem is not the strokeEnd, but the CGPath that you're using and that is clockwise.

I guess you want this: [[UIBezierPath bezierPathWithOvalInRect:yourRect] bezierPathByReversingPath].CGPath

EDIT:

another way would have been to use

strokeStart = 1 - strokeEnd; // not sure about the name "strokeStart"
strokeEnd = 1;

but the reversed path represents your intentions better

Upvotes: 3

Related Questions