In my app i have n arrays of annotations in my app, foodannotations, gasannotations, and shoppingannotations. I want each array of annotations to show a different colored pin. I am currently using.
Asked
Active
Viewed 107 times
0
-
:You got the answer. Post your answer and flag as duplicate. Instead of link show the answer that was more helpful to others – TamilKing Oct 31 '13 at 04:47
1 Answers
0
Already a discussion was been done regarding this. Please search question if it is already available before you ask. Thanks.
Pls refer the following links:
iPhone SDK: MapKit multiple custom annotations
Multiple Arrays of Annotations, Different Pin Color for Each Array?
Do this in viewForAnnotation:
int annType = ((YourAnnotationClass *)annotation).annotationType;
switch (annType)
{
case 0 : //Food
pinview.pinColor = MKPinAnnotationColorRed;
case 1 : //Gas
pinview.pinColor = MKPinAnnotationColorGreen;
default : //default or Shopping
pinview.pinColor = MKPinAnnotationColorPurple;
}

Community
- 1
- 1

Siddarth Hailstorm
- 180
- 2
- 15
-
-
Thats okay.I done like this you may get negative marks, Or they may duplicate your question. So please search every time before yu ask if it is already been discussed. – Siddarth Hailstorm Oct 31 '13 at 04:20
-
-
@SiddarthHailstorm link only answeres are discouraged on stackoverflow, please provide the actual answer answers or flag the Question as duplicate. – CloudyMarble Oct 31 '13 at 04:36
-
2@CloudyMarble Sorry sir, sure will edit it with my answer.Thanks – Siddarth Hailstorm Oct 31 '13 at 06:16
-
@siddarth : come on ! Thanks the problem is already solved . I refered the link and made my code. Anyway thanks. Best Wishes. – Oct 31 '13 at 06:23
-
1@user2918674 : May be it solved your problem just added the code for future reference of programmers facing this issue :) – Siddarth Hailstorm Oct 31 '13 at 06:24