Mkannotation image offset with custom pin image__it

Source: Internet
Author: User
</pre><pre>

Your Uiannotationview is always drawn at the same scale, the map ' zoom level doesn ' t matter. That ' s why centeroffset isn ' t bound with the zoom level.

Annview.centeroffset is what you need. If you do not have a your PIN at the good location (for example, the bottom center move a little while you are change the zoo M level), it ' s because you didn ' t set the right centeroffset.

By the way, if your want to set the "coordinate" at the bottom center of the image, the X coordinate of your CEN Teroffset should is 0.0f, as Annotationview Center the image by default. So try:

Annview.centeroffset = Cgpointmake (0,-IMAGEHEIGHT/2);

Or

Setting The Centeroffset often moves the image arround when user rotates or zooms the map, as anchor-point are still set to The center of the image instead of its lower center.

You can set the anchor point of the "annotation to" bottom center of you custom image as follows:

YourAnnotation.layer.anchorPoint = Cgpointmake (0.5f, 1.0f);

This is way when user zooms or rotates the map your custom annotation would never move from its coordinates on the map.
Http://stackoverflow.com/questions/8165262/mkannotation-image-offset-with-custom-pin-image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.