Search code examples
mkmapviewcgaffinetransform

MKAnnotationView Only Rotate the Image property


I have an MKAnnotationView where I want to rotate the image property only.

If I use the following...

        self.image= image;
        [self setTransform:CGAffineTransformMakeRotation(DEG2RAD([item.heading floatValue]))];

It rotates the whole annotationView and the subsequent callouts which I do not want. Is there a way to just rotate the image property?


Solution

  • The simplest way is probably to put the image in a UIImageView, add that as a subview to the MKAnnotationView, and affine that.

    If you are targeting iOS 5.0 you could look at CIAffineTransform but I don't know enough about CoreImage to advise.