Ok i still cant get it to work even moving everything globally heres what ive
found
If you add one pin onto the map with a calloutaccessory button it works
fine, adding a second pin then causes a crash when clicking the callout
button. I have been testing with the mapview example of the web
this all worked in previous mono versions can anyone else verify if they can
get this working or if its a mono bug
Heres an example of the code map delegate which can be downloaded from wrox
Map.GetViewForAnnotation = delegate (MKMapView mapView, NSObject
annotation)
{ // Called by the map whenever an annotation is added and needs to be
displayed
if (annotation is MKUserLocation) return null;
MyAnnotation myAnn = annotation as MyAnnotation;
var annView = mapView.DequeueReusableAnnotation ("mypin");
if (annView == null) {
var pinView = new MKPinAnnotationView(myAnn, "mypin");
pinView.AnimatesDrop = true;
pinView.PinColor = myAnn.Color;
pinView.CanShowCallout = true;
// Left callout Example #1
UIImage img = UIImage.FromFile("wrox.png");
UIImageView imgView = new UIImageView(img);
pinView.LeftCalloutAccessoryView = imgView;
// Left callout Example #2
/*
UIButton leftCallout =
UIButton.FromType(UIButtonType.InfoLight);
pinView.LeftCalloutAccessoryView = leftCallout;
*/
// Right callout
UIButton rightCallout =
UIButton.FromType(UIButtonType.DetailDisclosure);
rightCallout.TouchDown += delegate
{
NSUrl url = new NSUrl("http://wrox.com/");
if (!UIApplication.SharedApplication.OpenUrl(url))
{
System.Console.WriteLine("Sorry, can't open url");
}
};
pinView.RightCalloutAccessoryView = rightCallout;
annView = pinView;
}
else
{
annView.Annotation = annotation;
}
return annView;//annView;
};
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Mapview-Detaildisclosure-button-error-tp3549269p3552140.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch