I created a custom overlay that contains a geometric shape for an iOS application. I would like to rotate it around the center (or rather, to the center of boundingMapRect). From what I understand, using CGContextRotateCTM (contextRef, angle) rotates the overlay using the upper left corner of boundingMapRect as the source, so if I rotate my overlay a small amount clockwise, it appears down and to the left of it in the previous place.
I thought that if I could capture the initial center of the overlay bounding rectangle, then the center after the rotation, then I could calculate the coordinate difference and move the overlay using CGContextTranslateCTM. My problem is that the central locations were the same before and after the call to CGContextRotateCTM. Is there a way to make this call take effect so that I can get the new location of the center? Is there a better way to do this?
I have seen some references to using half width and overlay height for permutations, but I don’t understand how this helps, as it is permanent.
Thank.
justJ source
share