Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 482
Anil Kothari Avatar asked Nov 14 '22 10:11

Anil Kothari


1 Answers

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.

like image 141
tipycalFlow Avatar answered Nov 16 '22 03:11

tipycalFlow