0

I have a CAShapeLayer, I am able to rotate it using UIRotationGestureRecognizer. But when rotating, it only rotate its frame not the filled pattern inside it.

        CAShapeLayer *shapeLayer = [finalShapeLayersArray objectAtIndex:indextobeRotated];
        CGPathRef path = createPathRotatedAroundBoundingBoxCenter(shapeLayer.path,recognizer.rotation);
        shapeLayer.path  = path;
        CGPathRelease(path);
        recognizer.rotation = 0;

Bu doing this, it only rotates the boundary of the CAShapeLayer. I have filled a pattern with an image. I just want that pattern should also be rotated.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 2
    That's not enough information to answer your question. You need to **edit your question** and update with a more detailed description of your setup, preferably with code that demonstrates the problem. – DarkDust Dec 31 '13 at 11:52

1 Answers1

1

You need to set a rotation transform on your layer using CALayer's transform property instead (you do not rotate the the shape path then as the whole layer will be rotated).

See this answer on how to create such a transform. Also see the Core Animation Function Reference for all the functions that can create/modify transformations.

Community
  • 1
  • 1
DarkDust
  • 90,870
  • 19
  • 190
  • 224