Anil Kothari
Anil Kothari

Reputation: 7733

Draw color on country (Mapkit) when it is selected

enter image description here

enter image description here

I want to color the country on selection of the country from a tableView. Can you help me please?

Upvotes: 5

Views: 1697

Answers (1)

tipycalFlow
tipycalFlow

Reputation: 7644

Considering your case, let me give you a heads up that this would require edge detection (so if you haven't done that before, it will take a LONG time), though not lots of it and the following is just one way of approaching this problem:

1) Take out an image context from the map you have.

2) Apply relevant edge detection algorithms in the area you want and use a bright color to differentiate. Note that this way, the inside would not be colored and I can't tell you for sure if that's possible or not.

3) Add that context as a subView on top of the map.

Also take a look at the Quartz 2D programming guide for more tips.

I would suggest something different, though. Keep pre-stored images for all the possibilities and just put a UIImageView with that as its image in front of the map - this will save you a lot of headache.

Upvotes: 1

Related Questions