Created
April 1, 2016 15:29
-
-
Save edwardean/6045f4de846b221fdd4cb14057e43d0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)rotatePath:(UIBezierPath *)path degree:(CGFloat)degree { | |
CGRect bounds = CGPathGetBoundingBox(path.CGPath); | |
CGPoint center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); | |
CGFloat radians = (degree / 180.0f * M_PI); | |
CGAffineTransform transform = CGAffineTransformIdentity; | |
transform = CGAffineTransformTranslate(transform, center.x, center.y); | |
transform = CGAffineTransformRotate(transform, radians); | |
transform = CGAffineTransformTranslate(transform, -center.x, -center.y); | |
[path applyTransform:transform]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The swift version: