Should I use MKAnnotation, MKAnnotationView or MKPinAnnotation?

I call webservice and put some objects in MapView.

What I don't understand, should I use MKAnnotationPoint or MkAnnotationView? I'm not sure. When I use MKAnnotation, the pins are displayed on the map, if I click on them, they show me the name and subtitles.

If I use MKAnnotationView, contacts appear, but when I click on them, nothing happens.

I am also trying to add a right mouse button / chevron callout button, but also could not figure it out.

Here is 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 this, contacts will appear, but I cannot click on them.

If I just use:

mapView.AddAnotationObject(mk); //not using the MkAnnotationView

. , rightcallout. , - .

.

+5
1

MonoTouch, SDK - , iOS.

MKAnnotation - /, . MKPointAnnotation ( MKAnnotation) , title, subtitle coordinate.

MKAnnotationView , map viewForAnnotation ( ). , (, -). , MKAnnotationView , MKAnnotation ( ).

, MKAnnotation addAnnotation (.. AddAnnotationObject). viewForAnnotation MKAnnotationView.

"MKPinAnnotation" ( MKPinAnnotationView) MKAnnotationView, . MKPinAnnotationView viewForAnnotation .

, , viewForAnnotation. UIButton UIButtonTypeDetailDisclosure rightCalloutAccessoryView.

calloutAccessoryControlTapped , , .

iOS, MonoTouch .

+12

All Articles