0

I dont know i have mutable array ok mkannotation it is adding only one that too last one here is my code

code http://web.missouri.edu/~dnk6y2/Screen%20Shot%202012-11-12%20at%2011.46.05%20PM.png

Dheeraj Kaveti
  • 309
  • 1
  • 2
  • 9
  • I figured it out thanks. My code was adding a one annotation to my array and that was the problem.Sorry for wasting your time and thanks for helping me out – Dheeraj Kaveti Oct 02 '13 at 18:34

1 Answers1

1

You're adding kAnnotations (bad name by the way. That style of name kName is usually used for constants) to the contacts array, then changing its values and adding it again. But it is still the same object. Every time you change kAnnotations's coordinate and tile you're changing the one in the contacts array too. You need to create a new kAnnotation each time like this

CustomAnnotation *customAnno = [[CustomAnnotation alloc] init;
customAnno.coorindate = coord;
customAnno.title = name;
[contacts addObject:customAnno];
Craig
  • 8,093
  • 8
  • 42
  • 74