MKAnnotation
working - DEVICE ONLY.Thanks to Geoff and a bit of ObjC sample code I've figured out a little bit more of MapKit with MonoTouch.
MKPlacemarks
now appear (although I'm still working on MKAnnotation
).

The main changes from MapKit 101 are:
FoundWithPlacemark
Now calls the *Object method added by Geoff.
_appd.mapView.AddAnnotationObject(placemark);
MapViewDelegate
Updated to pass the annotation into the constructor of
MKPinAnnotationView
and also set the properties for animation, color and showing the callout when clicked.public override MKAnnotationView GetViewForAnnotationHopefully I can figure out the
(MKMapView mapView, NSObject annotation)
{
Console.WriteLine("get view MKAnnotation "+annotation);
var anv = mapView.DequeueReusableAnnotation("thislocation");
if (anv == null)
{
Console.WriteLine("creating new MKAnnotationView");
anv = new MKPinAnnotationView(annotation, "thislocation");
}
else
{
anv.Annotation = annotation;
}
anv.AnimatesDrop = true;
anv.PinColor = MKPinAnnotationColor.Green;
anv.CanShowCallout = true;
return anv;
}
MKAnnotation
issue too...
Thanks for the update, Craig. Do you have an updated ZIP file with the full example?
ReplyDeleteWas going to wait until MKAnnotation works too - IMO MKPlacemark isn't quite as useful as MKAnnotation anyway. Will try to get something up this weekend.
ReplyDelete