I'm calling a webservice and plotting some objects on a MapView.
What I'm failing to understand is should I use MKAnnotationPoint or MkAnnotationView? I'm not sure. When I use MKAnnotation, the pins show up on the map, if I click on them, they show me the title, and subtitle.
If I use MKAnnotationView, the pins show up but when I click on them, nothing happens.
I'm also trying to add the right button callout/chevron looking button but haven't been able to figure that out either.
Here's an example of my code.
MKPointAnnotation mk = new MKPointAnnotation();
MKAnnotationView mkView = new MKAnnotationView();
mk.Coordinate = coord;
mk.Title = tl.Name;
mk.Subtitle = DateTime.Now.ToShortDateString();
mkView.Annotation = mk;
mapView.AddAnnotationObject(mkView);
So if I do the above - the pins show up, but I can't click on any of them.
If I just use:
mapView.AddAnotationObject(mk); //not using the MkAnnotationView
Then they all show up and are clickable. I'm not sure how to add the rightcalloutbutton to them yet though. So that's kinda a second part to the question.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…